summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoraappleby@google.com <aappleby@google.com@77a7d1d3-4c08-bdc2-d393-d5859734b01a>2013-12-30 21:23:01 +0000
committeraappleby@google.com <aappleby@google.com@77a7d1d3-4c08-bdc2-d393-d5859734b01a>2013-12-30 21:23:01 +0000
commitb52816cce35fbfdda7d56c533cf53d15201513e3 (patch)
treea65df16f8a7db7db0e018fb19d990a932dd44e4f
parent5b8fd3c31a58b87b80605dca7a64fad6cb3f8a0f (diff)
downloadsrc-b52816cce35fbfdda7d56c533cf53d15201513e3.tar.gz
Merge patch to fix build under VS2010
git-svn-id: http://smhasher.googlecode.com/svn/trunk@151 77a7d1d3-4c08-bdc2-d393-d5859734b01a
-rw-r--r--MurmurHash1.h4
-rw-r--r--MurmurHash2.h4
-rw-r--r--MurmurHash3.h4
-rw-r--r--pstdint.h32
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
diff --git a/pstdint.h b/pstdint.h
index 43dce62..8bd4ad7 100644
--- a/pstdint.h
+++ b/pstdint.h
@@ -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))