@ -10,6 +10,7 @@
is under the MIT license .
is under the MIT license .
*/
*/
# include "murmurhash.h"
# include "murmurhash.h"
# include "port/lang.h"
# include "port/lang.h"
# if defined(__x86_64__)
# if defined(__x86_64__)
@ -28,6 +29,7 @@ __attribute__((__no_sanitize__("alignment")))
__attribute__ ( ( __no_sanitize_undefined__ ) )
__attribute__ ( ( __no_sanitize_undefined__ ) )
# endif
# endif
# endif
# endif
// clang-format off
uint64_t MurmurHash64A ( const void * key , int len , unsigned int seed )
uint64_t MurmurHash64A ( const void * key , int len , unsigned int seed )
{
{
const uint64_t m = 0xc6a4a7935bd1e995 ;
const uint64_t m = 0xc6a4a7935bd1e995 ;
@ -70,6 +72,7 @@ uint64_t MurmurHash64A ( const void * key, int len, unsigned int seed )
return h ;
return h ;
}
}
// clang-format on
# elif defined(__i386__)
# elif defined(__i386__)
@ -85,7 +88,7 @@ uint64_t MurmurHash64A ( const void * key, int len, unsigned int seed )
// 1. It will not work incrementally.
// 1. It will not work incrementally.
// 2. It will not produce the same results on little-endian and big-endian
// 2. It will not produce the same results on little-endian and big-endian
// machines.
// machines.
// clang-format off
unsigned int MurmurHash2 ( const void * key , int len , unsigned int seed )
unsigned int MurmurHash2 ( const void * key , int len , unsigned int seed )
{
{
// 'm' and 'r' are mixing constants generated offline.
// 'm' and 'r' are mixing constants generated offline.
@ -136,6 +139,7 @@ unsigned int MurmurHash2 ( const void * key, int len, unsigned int seed )
return h ;
return h ;
}
}
// clang-format on
# else
# else
@ -143,7 +147,7 @@ unsigned int MurmurHash2 ( const void * key, int len, unsigned int seed )
//
//
// Same as MurmurHash2, but endian- and alignment-neutral.
// Same as MurmurHash2, but endian- and alignment-neutral.
// Half the speed though, alas.
// Half the speed though, alas.
// clang-format off
unsigned int MurmurHashNeutral2 ( const void * key , int len , unsigned int seed )
unsigned int MurmurHashNeutral2 ( const void * key , int len , unsigned int seed )
{
{
const unsigned int m = 0x5bd1e995 ;
const unsigned int m = 0x5bd1e995 ;
@ -187,5 +191,6 @@ unsigned int MurmurHashNeutral2 ( const void * key, int len, unsigned int seed )
return h ;
return h ;
}
}
// clang-format on
# endif
# endif