//----------------------------------------------------------------------------- // 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. #include "MurmurHash3.h" //----------------------------------------------------------------------------- // Platform-specific functions and macros // Microsoft Visual Studio #if defined(_MSC_VER) #define FORCE_INLINE … #include <stdlib.h> #define ROTL32 … #define ROTL64 … #define BIG_CONSTANT … // Other compilers #else // defined(_MSC_VER) #define FORCE_INLINE … inline uint32_t rotl32 ( uint32_t x, int8_t r ) { … } inline uint64_t rotl64 ( uint64_t x, int8_t r ) { … } #define ROTL32(x,y) … #define ROTL64(x,y) … #define BIG_CONSTANT(x) … #endif // !defined(_MSC_VER) //----------------------------------------------------------------------------- // Block read - if your platform needs to do endian-swapping or can only // handle aligned reads, do the conversion here FORCE_INLINE uint32_t getblock32 ( const uint32_t * p, int i ) { … } FORCE_INLINE uint64_t getblock64 ( const uint64_t * p, int i ) { … } //----------------------------------------------------------------------------- // Finalization mix - force all bits of a hash block to avalanche FORCE_INLINE uint32_t fmix32 ( uint32_t h ) { … } //---------- FORCE_INLINE uint64_t fmix64 ( uint64_t k ) { … } //----------------------------------------------------------------------------- void MurmurHash3_x86_32 ( const void * key, int len, uint32_t seed, void * out ) { … } //----------------------------------------------------------------------------- void MurmurHash3_x86_128 ( const void * key, const int len, uint32_t seed, void * out ) { … } //----------------------------------------------------------------------------- void MurmurHash3_x64_128 ( const void * key, const int len, const uint32_t seed, void * out ) { … } //-----------------------------------------------------------------------------