roo_collections
API Documentation for roo_collections
Loading...
Searching...
No Matches
hash.cpp
Go to the documentation of this file.
2
3namespace roo_collections {
4
6 k *= 0xcc9e2d51;
7 k = (k << 15) | (k >> 17);
8 k *= 0x1b873593;
9 return k;
10}
11
12uint32_t murmur3_32(const void* key, size_t len, uint32_t seed) {
13 const unsigned char* buf = (const unsigned char*)key;
14 uint32_t h = seed;
15 uint32_t k;
16 for (size_t i = len >> 2; i; i--) {
17 k = (buf[0] << 24) | (buf[1] << 16) | (buf[2] << 8) | (buf[3]);
18 buf += 4;
20 h = (h << 13) | (h >> 19);
21 h = h * 5 + 0xe6546b64;
22 }
23 k = 0;
24 for (size_t i = len & 3; i; i--) {
25 k <<= 8;
26 k |= buf[i - 1];
27 }
29 h ^= len;
30 h ^= h >> 16;
31 h *= 0x85ebca6b;
32 h ^= h >> 13;
33 h *= 0xc2b2ae35;
34 h ^= h >> 16;
35 return h;
36}
37
38} // namespace roo_collections
Hashing utilities used by roo_collections containers.
uint32_t murmur3_32(const void *key, size_t len, uint32_t seed)
Computes 32-bit MurmurHash3 of a binary buffer.
Definition hash.cpp:12
static uint32_t murmur_32_scramble(uint32_t k)
Definition hash.cpp:5