summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortanjent@gmail.com <tanjent@gmail.com@77a7d1d3-4c08-bdc2-d393-d5859734b01a>2011-04-08 19:39:16 +0000
committertanjent@gmail.com <tanjent@gmail.com@77a7d1d3-4c08-bdc2-d393-d5859734b01a>2011-04-08 19:39:16 +0000
commit58dd8869da8c95f5c26ec70a6cdd243a7647c8fc (patch)
tree4573b3451822c8d50c613e83da226e54c83202c3
parent954fc28ca3b79ffe99d12d8c8b830d9b698d2266 (diff)
downloadsrc-58dd8869da8c95f5c26ec70a6cdd243a7647c8fc.tar.gz
Remove platform.h dependency from MurmurHash3.h, move platform #ifdefs to header
git-svn-id: http://smhasher.googlecode.com/svn/trunk@126 77a7d1d3-4c08-bdc2-d393-d5859734b01a
-rw-r--r--MurmurHash3.cpp45
-rw-r--r--MurmurHash3.h62
2 files changed, 59 insertions, 48 deletions
diff --git a/MurmurHash3.cpp b/MurmurHash3.cpp
index 1fec6a0..95d2e26 100644
--- a/MurmurHash3.cpp
+++ b/MurmurHash3.cpp
@@ -7,50 +7,7 @@
// compile and run any of them on any platform, but your performance with the
// non-native version will be less than optimal.
-//-----------------------------------------------------------------------------
-// Platform-specific functions and macros
-
-// Microsoft Visual Studio
-
-#if defined(_MSC_VER)
-
-typedef unsigned char uint8_t;
-typedef unsigned long uint32_t;
-typedef unsigned __int64 uint64_t;
-
-#define FORCE_INLINE __forceinline
-
-#include <stdlib.h>
-
-#define ROTL32(x,y) _rotl(x,y)
-#define ROTL64(x,y) _rotl64(x,y)
-
-#define BIG_CONSTANT(x) (x)
-
-// Other compilers
-
-#else // defined(_MSC_VER)
-
-#include <stdint.h>
-
-#define FORCE_INLINE __attribute__((always_inline))
-
-inline uint32_t rotl32 ( uint32_t x, int8_t r )
-{
- return (x << r) | (x >> (32 - r));
-}
-
-inline uint64_t rotl64 ( uint64_t x, int8_t r )
-{
- return (x << r) | (x >> (64 - r));
-}
-
-#define ROTL32(x,y) rotl32(x,y)
-#define ROTL64(x,y) rotl64(x,y)
-
-#define BIG_CONSTANT(x) (x##LLU)
-
-#endif // !defined(_MSC_VER)
+#include "MurmurHash3.h"
//-----------------------------------------------------------------------------
// Block read - if your platform needs to do endian-swapping or can only
diff --git a/MurmurHash3.h b/MurmurHash3.h
index a547f0f..a2f26e9 100644
--- a/MurmurHash3.h
+++ b/MurmurHash3.h
@@ -1,14 +1,68 @@
-#include "Platform.h"
+//-----------------------------------------------------------------------------
+// MurmurHash3 was written by Austin Appleby, and is placed in the public
+// domain. The author hereby disclaims copyright to this source code.
+
+// Note - The x86 and x64 versions do _not_ produce the same results, as the
+// algorithms are optimized for their respective platforms. You can still
+// compile and run any of them on any platform, but your performance with the
+// non-native version will be less than optimal.
+
+#ifndef _MURMURHASH3_H_
+#define _MURMURHASH3_H_
+
+//-----------------------------------------------------------------------------
+// Platform-specific functions and macros
+
+// Microsoft Visual Studio
+
+#if defined(_MSC_VER)
+
+typedef unsigned char uint8_t;
+typedef unsigned long uint32_t;
+typedef unsigned __int64 uint64_t;
+
+#define FORCE_INLINE __forceinline
+
+#include <stdlib.h>
+
+#define ROTL32(x,y) _rotl(x,y)
+#define ROTL64(x,y) _rotl64(x,y)
+
+#define BIG_CONSTANT(x) (x)
+
+// Other compilers
+
+#else // defined(_MSC_VER)
+
+#include <stdint.h>
+
+#define FORCE_INLINE __attribute__((always_inline))
+
+inline uint32_t rotl32 ( uint32_t x, int8_t r )
+{
+ return (x << r) | (x >> (32 - r));
+}
+
+inline uint64_t rotl64 ( uint64_t x, int8_t r )
+{
+ return (x << r) | (x >> (64 - r));
+}
+
+#define ROTL32(x,y) rotl32(x,y)
+#define ROTL64(x,y) rotl64(x,y)
+
+#define BIG_CONSTANT(x) (x##LLU)
+
+#endif // !defined(_MSC_VER)
//-----------------------------------------------------------------------------
void MurmurHash3_x86_32 ( const void * key, int len, uint32_t seed, void * out );
-void MurmurHash3_x86_64 ( const void * key, int len, uint32_t seed, void * out );
+
void MurmurHash3_x86_128 ( const void * key, int len, uint32_t seed, void * out );
-void MurmurHash3_x64_32 ( const void * key, int len, uint32_t seed, void * out );
-void MurmurHash3_x64_64 ( const void * key, int len, uint32_t seed, void * out );
void MurmurHash3_x64_128 ( const void * key, int len, uint32_t seed, void * out );
//-----------------------------------------------------------------------------
+#endif // _MURMURHASH3_H_ \ No newline at end of file