27 public long val1 {
get;
set; }
28 public long val2 {
get;
set; }
32 private static ulong fmix64( UInt64 k )
35 k *= 0xff51afd7ed558ccdL;
37 k *= 0xc4ceb9fe1a85ec53L;
49 private static ulong RotateLeft(
this ulong original,
int bits )
51 return ( original << bits ) | ( original >> ( 64 - bits ) );
62 ulong h1 = (ulong) (seed & 0x00000000FFFFFFFFL);
63 ulong h2 = (ulong) (seed & 0x00000000FFFFFFFFL);
65 const ulong c1 = 0x87c37b91114253d5L;
66 const ulong c2 = 0x4cf5ad432745937fL;
68 uint roundedEnd = offset + (len & 0xFFFFFFF0);
71 for (
int i = (
int)offset; i < roundedEnd; i += 16 )
73 ulong key1 = BitConverter.ToUInt64( key, i );
74 ulong key2 = BitConverter.ToUInt64( key, (i + 8) );
76 key1 *= c1; key1 = key1.RotateLeft( 31 ); key1 *= c2; h1 ^= key1;
77 h1 = h1.RotateLeft( 27 ); h1 += h2; h1 = h1 * 5 + 0x52dce729;
78 key2 *= c2; key2 = key2.RotateLeft( 33 ); key2 *= c1; h2 ^= key2;
79 h2 = h2.RotateLeft( 31 ); h2 += h1; h2 = h2 * 5 + 0x38495ab5;
89 k2 = ( ulong ) ( key[roundedEnd + 14] & 0xffL ) << 48;
92 k2 |= ( ulong ) ( key[roundedEnd + 13] & 0xffL ) << 40;
95 k2 |= ( ulong ) ( key[roundedEnd + 12] & 0xffL ) << 32;
98 k2 |= ( ulong ) ( key[roundedEnd + 11] & 0xffL ) << 24;
101 k2 |= ( ulong ) ( key[roundedEnd + 10] & 0xffL ) << 16;
104 k2 |= ( ulong ) ( key[roundedEnd + 9] & 0xffL ) << 8;
107 k2 |= ( ulong ) ( key[roundedEnd + 8] & 0xffL );
108 k2 *= c2; k2 = k2.RotateLeft( 33 ); k2 *= c1; h2 ^= k2;
113 k1 = ( ( ulong ) key[roundedEnd + 7] ) << 56;
116 k1 |= ( ulong ) ( key[roundedEnd + 6] & 0xffL ) << 48;
119 k1 |= ( ulong ) ( key[roundedEnd + 5] & 0xffL ) << 40;
122 k1 |= ( ulong ) ( key[roundedEnd + 4] & 0xffL ) << 32;
125 k1 |= ( ulong ) ( key[roundedEnd + 3] & 0xffL ) << 24;
128 k1 |= ( ulong ) ( key[roundedEnd + 2] & 0xffL ) << 16;
131 k1 |= ( ulong ) ( key[roundedEnd + 1] & 0xffL ) << 8;
134 k1 |= ( ulong ) ( key[roundedEnd] & 0xffL );
135 k1 *= c1; k1 = k1.RotateLeft( 31 ); k1 *= c2; h1 ^= k1;
156 output.val1 = (long) h1;
157 output.val2 = (long) h2;
static void murmurhash3_x64_128(byte[] key, uint offset, uint len, int seed, out LongPair output)
Returns the MurmurHash3_x64_128 hash, placing the result in output