@Override <T> long fetch64(Access<T> access, T in, long off) { return reverseBytes(super.fetch64(access, in, off)); }
private <T> long cityHashLen33To64(Access<T> access, T in, long off, long len) { long mul = mul(len); long a = fetch64(access, in, off) * K2; long b = fetch64(access, in, off + 8L); long c = fetch64(access, in, off + len - 24L); long d = fetch64(access, in, off + len - 32L); long e = fetch64(access, in, off + 16L) * K2; long f = fetch64(access, in, off + 24L) * 9L; long g = fetch64(access, in, off + len - 8L); long h = fetch64(access, in, off + len - 16L) * mul; long u = rotateRight(a + g, 43) + (rotateRight(b, 30) + c) * 9L; long v = ((a + g) ^ d) + f + 1L; long w = reverseBytes((u + v) * mul) + h; long x = rotateRight(e + f, 42) + c; long y = (reverseBytes((v + w) * mul) + g) * mul; long z = e + f + c; a = reverseBytes((x + z) * mul + y) + b; b = shiftMix((z + a) * mul + d + h) * mul; return b + x; }
private <T> long naHashLen33To64(Access<T> access, T in, long off, long len) { long mul = mul(len); long a = fetch64(access, in, off) * K2; long b = fetch64(access, in, off + 8L); long c = fetch64(access, in, off + len - 8) * mul; long d = fetch64(access, in, off + len - 16) * K2; long y = rotateRight(a + b, 43) + rotateRight(c, 30) + d; long z = hashLen16(y, a + rotateRight(b + K2, 18) + c, mul); long e = fetch64(access, in, off + 16) * mul; long f = fetch64(access, in, off + 24); long g = (y + fetch64(access, in, off + len - 32)) * mul; long h = (z + fetch64(access, in, off + len - 24)) * mul; return hashLen16(rotateRight(e + f, 43) + rotateRight(g, 30) + h, e + rotateRight(f + a, 18) + g, mul); }
<T> long hashLen17To32(Access<T> access, T in, long off, long len) { long mul = mul(len); long a = fetch64(access, in, off) * K1; long b = fetch64(access, in, off + 8L); long c = fetch64(access, in, off + len - 8L) * mul; long d = fetch64(access, in, off + len - 16L) * K2; return hashLen16(rotateRight(a + b, 43) + rotateRight(c, 30) + d, a + rotateRight(b + K2, 18) + c, mul); }
long x = fetch64(access, in, off + len - 40L); long y = fetch64(access, in, off + len - 16L) + fetch64(access, in, off + len - 56L); long z = hashLen16(fetch64(access, in, off + len - 48L) + len, fetch64(access, in, off + len - 24L)); long w4 = fetch64(access, in, off + len - 64L); long x4 = fetch64(access, in, off + len - 64L + 8L); long y4 = fetch64(access, in, off + len - 64L + 16L); long z4 = fetch64(access, in, off + len - 64L + 24L); a3 += w4; b3 = rotateRight(b3 + a3 + z4, 21); long w3 = fetch64(access, in, off + len - 32L); long x3 = fetch64(access, in, off + len - 32L + 8L); long y3 = fetch64(access, in, off + len - 32L + 16L); long z3 = fetch64(access, in, off + len - 32L + 24L); a2 += w3; b2 = rotateRight(b2 + a2 + z3, 21); x = x * K1 + fetch64(access, in, off); x = rotateRight(x + y + vFirst + fetch64(access, in, off + 8L), 37) * K1; y = rotateRight(y + vSecond + fetch64(access, in, off + 48L), 42) * K1; x ^= wSecond; y += vFirst + fetch64(access, in, off + 40L); z = rotateRight(z + wFirst, 33) * K1; long w2 = fetch64(access, in, off); long x2 = fetch64(access, in, off + 8L);
long v1 = 0, v2 = 0; long w1 = 0, w2 = 0; x = x * K2 + fetch64(access, in, off); x = rotateRight(x + y + v1 + fetch64(access, in, off + 8), 37) * K1; y = rotateRight(y + v2 + fetch64(access, in, off + 48), 42) * K1; x ^= w2; y += v1 + fetch64(access, in, off + 40); z = rotateRight(z + w1, 33) * K1; long a = v2 * K1; long b = x + w1; long z1 = fetch64(access, in, off + 24); a += fetch64(access, in, off); b = rotateRight(b + a + z1, 21); long c = a; a += fetch64(access, in, off + 8); a += fetch64(access, in, off + 16); b += rotateRight(a, 44); v1 = a + z1; v2 = b + c; long a1 = z + w2; long b1 = y + fetch64(access, in, off + 16); long z2 = fetch64(access, in, off + 32 + 24); a1 += fetch64(access, in, off + 32); b1 = rotateRight(b1 + a1 + z2, 21); long c1 = a1; a1 += fetch64(access, in, off + 32 + 8); a1 += fetch64(access, in, off + 32 + 16); b1 += rotateRight(a1, 44);
long a0 = fetch64(access, in, off); long a1 = fetch64(access, in, off + 8); long a2 = fetch64(access, in, off + 16); long a3 = fetch64(access, in, off + 24); long a4 = fetch64(access, in, off + 32); long a5 = fetch64(access, in, off + 40); long a6 = fetch64(access, in, off + 48); long a7 = fetch64(access, in, off + 56); x += a0 + a1; y += a2; u += y; y += u; x = rotateRight(y - x + v0 + fetch64(access, in, off + 8), 37) * mul; y = rotateRight(y ^ v1 ^ fetch64(access, in, off + 48), 42) * mul; x ^= w1 * 9; y += v0 + fetch64(access, in, off + 40); z = rotateRight(z + w0, 33) * mul; long z1 = fetch64(access, in, off + 24); a += fetch64(access, in, off); b = rotateRight(b + a + z1, 21); long c = a; a += fetch64(access, in, off + 8); a += fetch64(access, in, off + 16); b += rotateRight(a, 44); v0 = a + z1; long b1 = y + fetch64(access, in, off + 16);
<T> long hashLen0To16(Access<T> access, T in, long off, long len) { if (len >= 8L) { long a = fetch64(access, in, off); long b = fetch64(access, in, off + len - 8L); return hash8To16Bytes(len, a, b); } else if (len >= 4L) { long a = Primitives.unsignedInt(fetch32(access, in, off)); long b = Primitives.unsignedInt(fetch32(access, in, off + len - 4L)); return hash4To7Bytes(len, a, b); } else if (len > 0L) { int a = access.getUnsignedByte(in, off); int b = access.getUnsignedByte(in, off + (len >> 1)); int c = access.getUnsignedByte(in, off + len - 1L); return hash1To3Bytes((int) len, a, b, c); } return K2; }