| 134 | } |
| 135 | |
| 136 | unsigned int murmur_hash_inverse(unsigned int h, unsigned int seed) |
| 137 | { |
| 138 | const unsigned int m = 0x5bd1e995; |
| 139 | const unsigned int minv = 0xe59b19bd; // Multiplicative inverse of m under % 2^32 |
| 140 | const int r = 24; |
| 141 | |
| 142 | h = invert_shift_xor(h, 15); |
| 143 | h *= minv; |
| 144 | h = invert_shift_xor(h, 13); |
| 145 | |
| 146 | unsigned int hforward = seed ^ 4; |
| 147 | hforward *= m; |
| 148 | unsigned int k = hforward ^ h; |
| 149 | k *= minv; |
| 150 | k ^= k >> r; |
| 151 | k *= minv; |
| 152 | |
| 153 | #ifdef PLATFORM_BIG_ENDIAN |
| 154 | char* data = (char*)&k; |
| 155 | k = (data[0]) + (data[1] << 8) + (data[2] << 16) + (data[3] << 24); |
| 156 | #endif |
| 157 | |
| 158 | return k; |
| 159 | } |
| 160 | |
| 161 | uint64_t murmur_hash_64(const void* key, uint32_t len, uint64_t seed) |
| 162 | { |
nothing calls this directly
no test coverage detected