diff options
-rw-r--r-- | MurmurHash1.h | 4 | ||||
-rw-r--r-- | MurmurHash2.h | 4 | ||||
-rw-r--r-- | MurmurHash3.h | 4 | ||||
-rw-r--r-- | pstdint.h | 32 |
4 files changed, 24 insertions, 20 deletions
diff --git a/MurmurHash1.h b/MurmurHash1.h index 93b08c3..24e1ad3 100644 --- a/MurmurHash1.h +++ b/MurmurHash1.h @@ -10,10 +10,10 @@ // Microsoft Visual Studio -#if defined(_MSC_VER) +#if defined(_MSC_VER) && (_MSC_VER < 1600) typedef unsigned char uint8_t; -typedef unsigned long uint32_t; +typedef unsigned int uint32_t; typedef unsigned __int64 uint64_t; // Other compilers diff --git a/MurmurHash2.h b/MurmurHash2.h index 32993c2..6d289ed 100644 --- a/MurmurHash2.h +++ b/MurmurHash2.h @@ -10,10 +10,10 @@ // Microsoft Visual Studio -#if defined(_MSC_VER) +#if defined(_MSC_VER) && (_MSC_VER < 1600) typedef unsigned char uint8_t; -typedef unsigned long uint32_t; +typedef unsigned int uint32_t; typedef unsigned __int64 uint64_t; // Other compilers diff --git a/MurmurHash3.h b/MurmurHash3.h index 54e9d3f..e1c6d34 100644 --- a/MurmurHash3.h +++ b/MurmurHash3.h @@ -10,10 +10,10 @@ // Microsoft Visual Studio -#if defined(_MSC_VER) +#if defined(_MSC_VER) && (_MSC_VER < 1600) typedef unsigned char uint8_t; -typedef unsigned long uint32_t; +typedef unsigned int uint32_t; typedef unsigned __int64 uint64_t; // Other compilers @@ -376,18 +376,20 @@ # define UINT32_MAX (0xffffffffUL) #endif #ifndef uint32_t -#if (ULONG_MAX == UINT32_MAX) || defined (S_SPLINT_S) - typedef unsigned long uint32_t; -# define UINT32_C(v) v ## UL -# ifndef PRINTF_INT32_MODIFIER -# define PRINTF_INT32_MODIFIER "l" -# endif -#elif (UINT_MAX == UINT32_MAX) +// Try the 'natural' int type first. +// This is for compatibility with the stdint.h available on Windows. +#if (UINT_MAX == UINT32_MAX) && !defined (S_SPLINT_S) typedef unsigned int uint32_t; # ifndef PRINTF_INT32_MODIFIER # define PRINTF_INT32_MODIFIER "" # endif # define UINT32_C(v) v ## U +#elif (ULONG_MAX == UINT32_MAX) || defined (S_SPLINT_S) + typedef unsigned long uint32_t; +# define UINT32_C(v) v ## UL +# ifndef PRINTF_INT32_MODIFIER +# define PRINTF_INT32_MODIFIER "l" +# endif #elif (USHRT_MAX == UINT32_MAX) typedef unsigned short uint32_t; # define UINT32_C(v) ((unsigned short) (v)) @@ -406,18 +408,20 @@ # define INT32_MIN INT32_C(0x80000000) #endif #ifndef int32_t -#if (LONG_MAX == INT32_MAX) || defined (S_SPLINT_S) - typedef signed long int32_t; -# define INT32_C(v) v ## L -# ifndef PRINTF_INT32_MODIFIER -# define PRINTF_INT32_MODIFIER "l" -# endif -#elif (INT_MAX == INT32_MAX) +// Try the 'natural' int type first. +// This is for compatibility with the stdint.h available on Windows. +#if (INT_MAX == INT32_MAX) && !defined (S_SPLINT_S) typedef signed int int32_t; # define INT32_C(v) v # ifndef PRINTF_INT32_MODIFIER # define PRINTF_INT32_MODIFIER "" # endif +#elif (LONG_MAX == INT32_MAX) || defined (S_SPLINT_S) + typedef signed long int32_t; +# define INT32_C(v) v ## L +# ifndef PRINTF_INT32_MODIFIER +# define PRINTF_INT32_MODIFIER "l" +# endif #elif (SHRT_MAX == INT32_MAX) typedef signed short int32_t; # define INT32_C(v) ((short) (v)) |