MCPcopy Create free account
hub / github.com/Rezonality/zep / murmur_hash_inverse

Function murmur_hash_inverse

src/mcommon/string/stringutils.cpp:136–159  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

134}
135
136unsigned 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
161uint64_t murmur_hash_64(const void* key, uint32_t len, uint64_t seed)
162{

Callers

nothing calls this directly

Calls 1

invert_shift_xorFunction · 0.70

Tested by

no test coverage detected