6 // Robert Jenkins' function for mixing 32-bit values
7 // http://burtleburtle.net/bob/hash/evahash.html
8 // a, b = random bits, c = input and output
10 #define hashmix(a,b,c) \
11 a=a-b; a=a-c; a=a^(c>>13); \
12 b=b-c; b=b-a; b=b^(a<<8); \
13 c=c-a; c=c-b; c=c^(b>>13); \
14 a=a-b; a=a-c; a=a^(c>>12); \
15 b=b-c; b=b-a; b=b^(a<<16); \
16 c=c-a; c=c-b; c=c^(b>>5); \
17 a=a-b; a=a-c; a=a^(c>>3); \
18 b=b-c; b=b-a; b=b^(a<<10); \
19 c=c-a; c=c-b; c=c^(b>>15);
24 template <class _Key> struct rjhash { };
26 inline uint64_t rjhash64(uint64_t key) {
27 key = (~key) + (key << 21); // key = (key << 21) - key - 1;
28 key = key ^ (key >> 24);
29 key = (key + (key << 3)) + (key << 8); // key * 265
30 key = key ^ (key >> 14);
31 key = (key + (key << 2)) + (key << 4); // key * 21
32 key = key ^ (key >> 28);
33 key = key + (key << 31);
37 inline uint32_t rjhash32(uint32_t a) {
38 a = (a+0x7ed55d16) + (a<<12);
39 a = (a^0xc761c23c) ^ (a>>19);
40 a = (a+0x165667b1) + (a<<5);
41 a = (a+0xd3a2646c) ^ (a<<9);
42 a = (a+0xfd7046c5) + (a<<3);
43 a = (a^0xb55a4f09) ^ (a>>16);
48 template<> struct rjhash<uint32_t> {
49 inline size_t operator()(const uint32_t x) const {
54 template<> struct rjhash<uint64_t> {
55 inline size_t operator()(const uint64_t x) const {