2 * based on code written by Austin Appleby and placed in the public domain
5 /* TODO: x86 and big endian */
9 #define ROTL64(x,n) (((x) << (n)) | ((x) >> (64 - (n))))
11 static inline uint64_t
12 getblock64(const uint64_t *p
, int i
)
17 static inline uint64_t
21 k
*= 0xff51afd7ed558ccdLLU
;
23 k
*= 0xc4ceb9fe1a85ec53LLU
;
29 murmurhash3_x64_128(const void *key
, const int len
, const uint32_t seed
, void *out
)
31 const uint8_t *data
= (const uint8_t *)key
;
32 const uint64_t *blocks
= (const uint64_t *)(data
);
33 const int nblocks
= len
/ 16;
34 const uint64_t c1
= 0x87c37b91114253d5LLU
;
35 const uint64_t c2
= 0x4cf5ad432745937fLLU
;
36 const uint8_t *tail
= (const uint8_t *)(data
+ nblocks
* 16);
43 for(i
= 0 ; i
< nblocks
; i
++) {
44 k1
= getblock64(blocks
, i
* 2 + 0);
45 k2
= getblock64(blocks
, i
* 2 + 1);
52 h1
= h1
* 5 + 0x52dce729;
59 h2
= h2
* 5 + 0x38495ab5;
66 k2
^= ((uint64_t)tail
[14]) << 48;
68 k2
^= ((uint64_t)tail
[13]) << 40;
70 k2
^= ((uint64_t)tail
[12]) << 32;
72 k2
^= ((uint64_t)tail
[11]) << 24;
74 k2
^= ((uint64_t)tail
[10]) << 16;
76 k2
^= ((uint64_t)tail
[9]) << 8;
78 k2
^= ((uint64_t)tail
[8]) << 0;
84 k1
^= ((uint64_t)tail
[7]) << 56;
86 k1
^= ((uint64_t)tail
[6]) << 48;
88 k1
^= ((uint64_t)tail
[5]) << 40;
90 k1
^= ((uint64_t)tail
[4]) << 32;
92 k1
^= ((uint64_t)tail
[3]) << 24;
94 k1
^= ((uint64_t)tail
[2]) << 16;
96 k1
^= ((uint64_t)tail
[1]) << 8;
98 k1
^= ((uint64_t)tail
[0]) << 0;
114 ((uint64_t*)out
)[0] = h1
;
115 ((uint64_t*)out
)[1] = h2
;