1 #ifndef RADIX_UTIL_HASH_HPP
2 #define RADIX_UTIL_HASH_HPP
12 constexpr
unsigned int MurmurHash2(
const void *key,
int len,
unsigned int seed) {
13 static_assert(
sizeof(
int) == 4,
"int type isn't 4 bytes long");
14 const unsigned int m = 0x5bd1e995;
16 unsigned int h = seed ^ len;
17 const unsigned char *data = (
const unsigned char*)key;
19 unsigned int k = *(
unsigned int *)data;
29 case 3: h ^= data[2] << 16;
30 case 2: h ^= data[1] << 8;
41 static_assert(
sizeof(
int) == 4,
"int type isn't 4 bytes long");
42 const unsigned int m = 0x5bd1e995;
44 unsigned int h = seed ^ len;
45 const char *data = key;
47 unsigned int k = data[0];
60 case 3: h ^= data[2] << 16;
61 case 2: h ^= data[1] << 8;
81 constexpr uint32_t
Hash32(
const char *str) {
Definition: GameController.hpp:7
constexpr unsigned int MurmurHashNeutral2(const char *key, int len, unsigned int seed)
Definition: Hash.hpp:40
constexpr int conststrlen(const char *str)
Definition: Hash.hpp:77
constexpr uint32_t Hash32(const char *str)
Definition: Hash.hpp:81