diff --git a/mio/lib/mio-cmn.h b/mio/lib/mio-cmn.h index 539be0a..faaf3ef 100644 --- a/mio/lib/mio-cmn.h +++ b/mio/lib/mio-cmn.h @@ -65,21 +65,29 @@ #if defined(MIO_SIZEOF_CHAR) && (MIO_SIZEOF_CHAR == 1) # define MIO_HAVE_UINT8_T # define MIO_HAVE_INT8_T +# define MIO_SIZEOF_UINT8_T (MIO_SIZEOF_CHAR) +# define MIO_SIZEOF_INT8_T (MIO_SIZEOF_CHAR) typedef unsigned char mio_uint8_t; typedef signed char mio_int8_t; #elif defined(MIO_SIZEOF___INT8) && (MIO_SIZEOF___INT8 == 1) # define MIO_HAVE_UINT8_T # define MIO_HAVE_INT8_T +# define MIO_SIZEOF_UINT8_T (MIO_SIZEOF___INT8) +# define MIO_SIZEOF_INT8_T (MIO_SIZEOF___INT8) typedef unsigned __int8 mio_uint8_t; typedef signed __int8 mio_int8_t; #elif defined(MIO_SIZEOF___INT8_T) && (MIO_SIZEOF___INT8_T == 1) # define MIO_HAVE_UINT8_T # define MIO_HAVE_INT8_T +# define MIO_SIZEOF_UINT8_T (MIO_SIZEOF___INT8_T) +# define MIO_SIZEOF_INT8_T (MIO_SIZEOF___INT8_T) typedef unsigned __int8_t mio_uint8_t; typedef signed __int8_t mio_int8_t; #else # define MIO_HAVE_UINT8_T # define MIO_HAVE_INT8_T +# define MIO_SIZEOF_UINT8_T (1) +# define MIO_SIZEOF_INT8_T (1) typedef unsigned char mio_uint8_t; typedef signed char mio_int8_t; #endif @@ -88,21 +96,29 @@ #if defined(MIO_SIZEOF_SHORT) && (MIO_SIZEOF_SHORT == 2) # define MIO_HAVE_UINT16_T # define MIO_HAVE_INT16_T +# define MIO_SIZEOF_UINT16_T (MIO_SIZEOF_SHORT) +# define MIO_SIZEOF_INT16_T (MIO_SIZEOF_SHORT) typedef unsigned short int mio_uint16_t; typedef signed short int mio_int16_t; #elif defined(MIO_SIZEOF___INT16) && (MIO_SIZEOF___INT16 == 2) # define MIO_HAVE_UINT16_T # define MIO_HAVE_INT16_T +# define MIO_SIZEOF_UINT16_T (MIO_SIZEOF___INT16) +# define MIO_SIZEOF_INT16_T (MIO_SIZEOF___INT16) typedef unsigned __int16 mio_uint16_t; typedef signed __int16 mio_int16_t; #elif defined(MIO_SIZEOF___INT16_T) && (MIO_SIZEOF___INT16_T == 2) # define MIO_HAVE_UINT16_T # define MIO_HAVE_INT16_T +# define MIO_SIZEOF_UINT16_T (MIO_SIZEOF___INT16_T) +# define MIO_SIZEOF_INT16_T (MIO_SIZEOF___INT16_T) typedef unsigned __int16_t mio_uint16_t; typedef signed __int16_t mio_int16_t; #else # define MIO_HAVE_UINT16_T # define MIO_HAVE_INT16_T +# define MIO_SIZEOF_UINT16_T (2) +# define MIO_SIZEOF_INT16_T (2) typedef unsigned short int mio_uint16_t; typedef signed short int mio_int16_t; #endif @@ -112,31 +128,43 @@ #if defined(MIO_SIZEOF_INT) && (MIO_SIZEOF_INT == 4) # define MIO_HAVE_UINT32_T # define MIO_HAVE_INT32_T +# define MIO_SIZEOF_UINT32_T (MIO_SIZEOF_INT) +# define MIO_SIZEOF_INT32_T (MIO_SIZEOF_INT) typedef unsigned int mio_uint32_t; typedef signed int mio_int32_t; #elif defined(MIO_SIZEOF_LONG) && (MIO_SIZEOF_LONG == 4) # define MIO_HAVE_UINT32_T # define MIO_HAVE_INT32_T - typedef unsigned long mio_uint32_t; - typedef signed long mio_int32_t; +# define MIO_SIZEOF_UINT32_T (MIO_SIZEOF_LONG) +# define MIO_SIZEOF_INT32_T (MIO_SIZEOF_LONG) + typedef unsigned long int mio_uint32_t; + typedef signed long int mio_int32_t; #elif defined(MIO_SIZEOF___INT32) && (MIO_SIZEOF___INT32 == 4) # define MIO_HAVE_UINT32_T # define MIO_HAVE_INT32_T +# define MIO_SIZEOF_UINT32_T (MIO_SIZEOF___INT32) +# define MIO_SIZEOF_INT32_T (MIO_SIZEOF___INT32) typedef unsigned __int32 mio_uint32_t; typedef signed __int32 mio_int32_t; #elif defined(MIO_SIZEOF___INT32_T) && (MIO_SIZEOF___INT32_T == 4) # define MIO_HAVE_UINT32_T # define MIO_HAVE_INT32_T +# define MIO_SIZEOF_UINT32_T (MIO_SIZEOF___INT32_T) +# define MIO_SIZEOF_INT32_T (MIO_SIZEOF___INT32_T) typedef unsigned __int32_t mio_uint32_t; typedef signed __int32_t mio_int32_t; -#elif defined(__MSDOS__) +#elif defined(__DOS__) # define MIO_HAVE_UINT32_T # define MIO_HAVE_INT32_T +# define MIO_SIZEOF_UINT32_T (4) +# define MIO_SIZEOF_INT32_T (4) typedef unsigned long int mio_uint32_t; typedef signed long int mio_int32_t; #else # define MIO_HAVE_UINT32_T # define MIO_HAVE_INT32_T +# define MIO_SIZEOF_UINT32_T (4) +# define MIO_SIZEOF_INT32_T (4) typedef unsigned int mio_uint32_t; typedef signed int mio_int32_t; #endif @@ -145,33 +173,38 @@ #if defined(MIO_SIZEOF_INT) && (MIO_SIZEOF_INT == 8) # define MIO_HAVE_UINT64_T # define MIO_HAVE_INT64_T +# define MIO_SIZEOF_UINT64_T (MIO_SIZEOF_INT) +# define MIO_SIZEOF_INT64_T (MIO_SIZEOF_INT) typedef unsigned int mio_uint64_t; typedef signed int mio_int64_t; #elif defined(MIO_SIZEOF_LONG) && (MIO_SIZEOF_LONG == 8) # define MIO_HAVE_UINT64_T # define MIO_HAVE_INT64_T - typedef unsigned long mio_uint64_t; - typedef signed long mio_int64_t; +# define MIO_SIZEOF_UINT64_T (MIO_SIZEOF_LONG) +# define MIO_SIZEOF_INT64_T (MIO_SIZEOF_LONG) + typedef unsigned long int mio_uint64_t; + typedef signed long int mio_int64_t; #elif defined(MIO_SIZEOF_LONG_LONG) && (MIO_SIZEOF_LONG_LONG == 8) # define MIO_HAVE_UINT64_T # define MIO_HAVE_INT64_T - typedef unsigned long long mio_uint64_t; - typedef signed long long mio_int64_t; +# define MIO_SIZEOF_UINT64_T (MIO_SIZEOF_LONG_LONG) +# define MIO_SIZEOF_INT64_T (MIO_SIZEOF_LONG_LONG) + typedef unsigned long long int mio_uint64_t; + typedef signed long long int mio_int64_t; #elif defined(MIO_SIZEOF___INT64) && (MIO_SIZEOF___INT64 == 8) # define MIO_HAVE_UINT64_T # define MIO_HAVE_INT64_T +# define MIO_SIZEOF_UINT64_T (MIO_SIZEOF_LONG___INT64) +# define MIO_SIZEOF_INT64_T (MIO_SIZEOF_LONG___INT64) typedef unsigned __int64 mio_uint64_t; typedef signed __int64 mio_int64_t; #elif defined(MIO_SIZEOF___INT64_T) && (MIO_SIZEOF___INT64_T == 8) # define MIO_HAVE_UINT64_T # define MIO_HAVE_INT64_T +# define MIO_SIZEOF_UINT64_T (MIO_SIZEOF_LONG___INT64_T) +# define MIO_SIZEOF_INT64_T (MIO_SIZEOF_LONG___INT64_T) typedef unsigned __int64_t mio_uint64_t; typedef signed __int64_t mio_int64_t; -#elif defined(_WIN64) || defined(_WIN32) -# define MIO_HAVE_UINT64_T -# define MIO_HAVE_INT64_T - typedef unsigned __int64 mio_uint64_t; - typedef signed __int64 mio_int64_t; #else /* no 64-bit integer */ #endif @@ -180,26 +213,36 @@ #if defined(MIO_SIZEOF_INT) && (MIO_SIZEOF_INT == 16) # define MIO_HAVE_UINT128_T # define MIO_HAVE_INT128_T +# define MIO_SIZEOF_UINT128_T (MIO_SIZEOF_INT) +# define MIO_SIZEOF_INT128_T (MIO_SIZEOF_INT) typedef unsigned int mio_uint128_t; typedef signed int mio_int128_t; #elif defined(MIO_SIZEOF_LONG) && (MIO_SIZEOF_LONG == 16) # define MIO_HAVE_UINT128_T # define MIO_HAVE_INT128_T - typedef unsigned long mio_uint128_t; - typedef signed long mio_int128_t; +# define MIO_SIZEOF_UINT128_T (MIO_SIZEOF_LONG) +# define MIO_SIZEOF_INT128_T (MIO_SIZEOF_LONG) + typedef unsigned long int mio_uint128_t; + typedef signed long int mio_int128_t; #elif defined(MIO_SIZEOF_LONG_LONG) && (MIO_SIZEOF_LONG_LONG == 16) # define MIO_HAVE_UINT128_T # define MIO_HAVE_INT128_T - typedef unsigned long long mio_uint128_t; - typedef signed long long mio_int128_t; +# define MIO_SIZEOF_UINT128_T (MIO_SIZEOF_LONG_LONG) +# define MIO_SIZEOF_INT128_T (MIO_SIZEOF_LONG_LONG) + typedef unsigned long long int mio_uint128_t; + typedef signed long long int mio_int128_t; #elif defined(MIO_SIZEOF___INT128) && (MIO_SIZEOF___INT128 == 16) # define MIO_HAVE_UINT128_T # define MIO_HAVE_INT128_T +# define MIO_SIZEOF_UINT128_T (MIO_SIZEOF___INT128) +# define MIO_SIZEOF_INT128_T (MIO_SIZEOF___INT128) typedef unsigned __int128 mio_uint128_t; typedef signed __int128 mio_int128_t; #elif defined(MIO_SIZEOF___INT128_T) && (MIO_SIZEOF___INT128_T == 16) # define MIO_HAVE_UINT128_T # define MIO_HAVE_INT128_T +# define MIO_SIZEOF_UINT128_T (MIO_SIZEOF___INT128_T) +# define MIO_SIZEOF_INT128_T (MIO_SIZEOF___INT128_T) #if defined(MIO_SIZEOF___UINT128_T) && (MIO_SIZEOF___UINT128_T == MIO_SIZEOF___INT128_T) typedef __uint128_t mio_uint128_t; typedef __int128_t mio_int128_t; @@ -214,6 +257,7 @@ /* no 128-bit integer */ #endif + #if defined(MIO_HAVE_UINT8_T) && (MIO_SIZEOF_VOID_P == 1) # error UNSUPPORTED POINTER SIZE #elif defined(MIO_HAVE_UINT16_T) && (MIO_SIZEOF_VOID_P == 2) @@ -771,6 +815,8 @@ struct mio_cmgr_t #if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) #define MIO_HAVE_BUILTIN_CTZ + #define MIO_HAVE_BUILTIN_CTZL + #define MIO_HAVE_BUILTIN_CTZLL #define MIO_HAVE_BUILTIN_EXPECT #endif