21 #define FORCE_INLINE __forceinline 25 #define ROTL32(x,y) _rotl(x,y) 26 #define ROTL64(x,y) _rotl64(x,y) 28 #define BIG_CONSTANT(x) (x) 32 #else // defined(_MSC_VER) 35 #define FORCE_INLINE inline 39 return (x << r) | (x >> (32 - r));
44 return (x << r) | (x >> (64 - r));
47 #define ROTL32(x,y) rotl32(x,y) 48 #define ROTL64(x,y) rotl64(x,y) 50 #define BIG_CONSTANT(x) (x##LLU) 52 #endif // !defined(_MSC_VER) 99 const u8 * data = (
const u8*)key;
100 const int nblocks = len / 4;
110 const u32 * blocks = (
const u32 *)(data + nblocks*4);
112 for(
int i = -nblocks; i; i++)
122 h1 = h1*5+0xe6546b64;
128 const u8 * tail = (
const u8*)(data + nblocks*4);
134 case 3: k1 ^= tail[2] << 16;
135 case 2: k1 ^= tail[1] << 8;
136 case 1: k1 ^= tail[0];
137 k1 *= c1; k1 =
ROTL32(k1,15); k1 *= c2; h1 ^= k1;
154 const u8 * data = (
const u8*)key;
155 const int nblocks = len / 16;
170 const u32 * blocks = (
const u32 *)(data + nblocks*16);
172 for(
int i = -nblocks; i; i++)
179 k1 *= c1; k1 =
ROTL32(k1,15); k1 *= c2; h1 ^= k1;
181 h1 =
ROTL32(h1,19); h1 += h2; h1 = h1*5+0x561ccd1b;
183 k2 *= c2; k2 =
ROTL32(k2,16); k2 *= c3; h2 ^= k2;
185 h2 =
ROTL32(h2,17); h2 += h3; h2 = h2*5+0x0bcaa747;
187 k3 *= c3; k3 =
ROTL32(k3,17); k3 *= c4; h3 ^= k3;
189 h3 =
ROTL32(h3,15); h3 += h4; h3 = h3*5+0x96cd1c35;
191 k4 *= c4; k4 =
ROTL32(k4,18); k4 *= c1; h4 ^= k4;
193 h4 =
ROTL32(h4,13); h4 += h1; h4 = h4*5+0x32ac3b17;
199 const u8 * tail = (
const u8*)(data + nblocks*16);
208 case 15: k4 ^= tail[14] << 16;
209 case 14: k4 ^= tail[13] << 8;
210 case 13: k4 ^= tail[12] << 0;
211 k4 *= c4; k4 =
ROTL32(k4,18); k4 *= c1; h4 ^= k4;
213 case 12: k3 ^= tail[11] << 24;
214 case 11: k3 ^= tail[10] << 16;
215 case 10: k3 ^= tail[ 9] << 8;
216 case 9: k3 ^= tail[ 8] << 0;
217 k3 *= c3; k3 =
ROTL32(k3,17); k3 *= c4; h3 ^= k3;
219 case 8: k2 ^= tail[ 7] << 24;
220 case 7: k2 ^= tail[ 6] << 16;
221 case 6: k2 ^= tail[ 5] << 8;
222 case 5: k2 ^= tail[ 4] << 0;
223 k2 *= c2; k2 =
ROTL32(k2,16); k2 *= c3; h2 ^= k2;
225 case 4: k1 ^= tail[ 3] << 24;
226 case 3: k1 ^= tail[ 2] << 16;
227 case 2: k1 ^= tail[ 1] << 8;
228 case 1: k1 ^= tail[ 0] << 0;
229 k1 *= c1; k1 =
ROTL32(k1,15); k1 *= c2; h1 ^= k1;
235 h1 ^= len; h2 ^= len; h3 ^= len; h4 ^= len;
237 h1 += h2; h1 += h3; h1 += h4;
238 h2 += h1; h3 += h1; h4 += h1;
245 h1 += h2; h1 += h3; h1 += h4;
246 h2 += h1; h3 += h1; h4 += h1;
258 const u8 * data = (
const u8*)key;
259 const int nblocks = len / 16;
270 const u64 * blocks = (
const u64 *)(data);
272 for(
int i = 0; i < nblocks; i++)
277 k1 *= c1; k1 =
ROTL64(k1,31); k1 *= c2; h1 ^= k1;
279 h1 =
ROTL64(h1,27); h1 += h2; h1 = h1*5+0x52dce729;
281 k2 *= c2; k2 =
ROTL64(k2,33); k2 *= c1; h2 ^= k2;
283 h2 =
ROTL64(h2,31); h2 += h1; h2 = h2*5+0x38495ab5;
289 const u8 * tail = (
const u8*)(data + nblocks*16);
296 case 15: k2 ^=
u64(tail[14]) << 48;
297 case 14: k2 ^=
u64(tail[13]) << 40;
298 case 13: k2 ^=
u64(tail[12]) << 32;
299 case 12: k2 ^=
u64(tail[11]) << 24;
300 case 11: k2 ^=
u64(tail[10]) << 16;
301 case 10: k2 ^=
u64(tail[ 9]) << 8;
302 case 9: k2 ^=
u64(tail[ 8]) << 0;
303 k2 *= c2; k2 =
ROTL64(k2,33); k2 *= c1; h2 ^= k2;
305 case 8: k1 ^=
u64(tail[ 7]) << 56;
306 case 7: k1 ^=
u64(tail[ 6]) << 48;
307 case 6: k1 ^=
u64(tail[ 5]) << 40;
308 case 5: k1 ^=
u64(tail[ 4]) << 32;
309 case 4: k1 ^=
u64(tail[ 3]) << 24;
310 case 3: k1 ^=
u64(tail[ 2]) << 16;
311 case 2: k1 ^=
u64(tail[ 1]) << 8;
312 case 1: k1 ^=
u64(tail[ 0]) << 0;
313 k1 *= c1; k1 =
ROTL64(k1,31); k1 *= c2; h1 ^= k1;
319 h1 ^= len; h2 ^= len;
FORCE_INLINE u32 fmix(u32 h)
unsigned long long u64
64 bits unsigned integer
unsigned char u8
8 bits unsigned integer
FORCE_INLINE u32 getblock(const u32 *p, int i)
VLCORE_EXPORT void MurmurHash3_x64_128(const void *key, int len, u32 seed, void *out)
Visualization Library main namespace.
unsigned int u32
32 bits unsigned integer
VLCORE_EXPORT void MurmurHash3_x86_32(const void *key, int len, u32 seed, void *out)
char i8
8 bits signed integer
VLCORE_EXPORT void MurmurHash3_x86_128(const void *key, int len, u32 seed, void *out)