in common/include/MurmurHash3.h [95:168]
MURMUR3_FORCE_INLINE void MurmurHash3_x64_128(const void* key, size_t lenBytes,
uint64_t seed, HashState& out) {
static const uint64_t c1 = MURMUR3_BIG_CONSTANT(0x87c37b91114253d5);
static const uint64_t c2 = MURMUR3_BIG_CONSTANT(0x4cf5ad432745937f);
const uint8_t* data = (const uint8_t*)key;
out.h1 = seed;
out.h2 = seed;
// Number of full 128-bit blocks of 16 bytes.
// Possible exclusion of a remainder of up to 15 bytes.
const size_t nblocks = lenBytes >> 4; // bytes / 16
// Process the 128-bit blocks (the body) into the hash
const uint64_t* blocks = (const uint64_t*)(data);
for (size_t i = 0; i < nblocks; ++i) { // 16 bytes per block
uint64_t k1 = getblock64(blocks, i * 2 + 0);
uint64_t k2 = getblock64(blocks, i * 2 + 1);
k1 *= c1; k1 = MURMUR3_ROTL64(k1,31); k1 *= c2; out.h1 ^= k1;
out.h1 = MURMUR3_ROTL64(out.h1,27);
out.h1 += out.h2;
out.h1 = out.h1*5+0x52dce729;
k2 *= c2; k2 = MURMUR3_ROTL64(k2,33); k2 *= c1; out.h2 ^= k2;
out.h2 = MURMUR3_ROTL64(out.h2,31);
out.h2 += out.h1;
out.h2 = out.h2*5+0x38495ab5;
}
// tail
const uint8_t * tail = (const uint8_t*)(data + (nblocks << 4));
uint64_t k1 = 0;
uint64_t k2 = 0;
switch(lenBytes & 15)
{
case 15: k2 ^= ((uint64_t)tail[14]) << 48; // falls through
case 14: k2 ^= ((uint64_t)tail[13]) << 40; // falls through
case 13: k2 ^= ((uint64_t)tail[12]) << 32; // falls through
case 12: k2 ^= ((uint64_t)tail[11]) << 24; // falls through
case 11: k2 ^= ((uint64_t)tail[10]) << 16; // falls through
case 10: k2 ^= ((uint64_t)tail[ 9]) << 8; // falls through
case 9: k2 ^= ((uint64_t)tail[ 8]) << 0;
k2 *= c2; k2 = MURMUR3_ROTL64(k2,33); k2 *= c1; out.h2 ^= k2;
// falls through
case 8: k1 ^= ((uint64_t)tail[ 7]) << 56; // falls through
case 7: k1 ^= ((uint64_t)tail[ 6]) << 48; // falls through
case 6: k1 ^= ((uint64_t)tail[ 5]) << 40; // falls through
case 5: k1 ^= ((uint64_t)tail[ 4]) << 32; // falls through
case 4: k1 ^= ((uint64_t)tail[ 3]) << 24; // falls through
case 3: k1 ^= ((uint64_t)tail[ 2]) << 16; // falls through
case 2: k1 ^= ((uint64_t)tail[ 1]) << 8; // falls through
case 1: k1 ^= ((uint64_t)tail[ 0]) << 0;
k1 *= c1; k1 = MURMUR3_ROTL64(k1,31); k1 *= c2; out.h1 ^= k1;
};
//----------
// finalization
out.h1 ^= lenBytes;
out.h2 ^= lenBytes;
out.h1 += out.h2;
out.h2 += out.h1;
out.h1 = fmix64(out.h1);
out.h2 = fmix64(out.h2);
out.h1 += out.h2;
out.h2 += out.h1;
}