@Override public int getUnsignedByte(Object input, long offset) { return unsignedByte(getByte(input, offset)); }
@Override public long getUnsignedInt(ByteBuffer input, long offset) { return Primitives.unsignedInt(getInt(input, offset)); }
@Override public int getUnsignedShort(Object input, long offset) { return unsignedShort(getShort(input, offset)); }
@Override public long getUnsignedInt(Object input, long offset) { return unsignedInt(getInt(input, offset)); }
@Override public int getUnsignedByte(ByteBuffer input, long offset) { return Primitives.unsignedByte(getByte(input, offset)); }
@Override public int getUnsignedShort(ByteBuffer input, long offset) { return Primitives.unsignedShort(getShort(input, offset)); }
@Override public long hashInt(int input) { return hashNativeLong(unsignedInt(NATIVE_MURMUR.toLittleEndian(input)), 4L); }
@Override public long hashByte(byte input) { return hashNativeLong((long) Primitives.unsignedByte((int) input), 1L); }
@Override public long hashShort(short input) { return hashNativeLong( (long) NATIVE_MURMUR.toLittleEndianShort(Primitives.unsignedShort(input)), 2L); }
@Override public long hashInt(int input) { input = NATIVE_METRO.toLittleEndian(input); long h = (seed() + k2) * k0; h += Primitives.unsignedInt(input) * k3; h ^= Long.rotateRight(h, 26) * k1; return MetroHash.finalize(h); }
static int getUnsignedByte(CharSequence input, long offset, int shift) { return Primitives.unsignedByte(input.charAt(ix(offset)) >> shift); }
@Override public long hashShort(short input) { input = NATIVE_METRO.toLittleEndian(input); long h = (seed() + k2) * k0; h += Primitives.unsignedShort(input) * k3; h ^= Long.rotateRight(h, 48) * k1; return MetroHash.finalize(h); }
@Override public long hashInt(int input) { input = NATIVE_XX.toLittleEndian(input); long hash = seed() + P5 + 4; hash ^= Primitives.unsignedInt(input) * P1; hash = Long.rotateLeft(hash, 23) * P2 + P3; return XxHash.finalize(hash); }
@Override public long hashByte(byte input) { int unsignedByte = Primitives.unsignedByte(input); long hash = hash1To3Bytes(1, unsignedByte, unsignedByte, unsignedByte); return finalize(hash); }
@Override public long hashInt(int input) { input = NATIVE_CITY.toLittleEndian(input); long unsignedInt = Primitives.unsignedInt(input); long hash = hash4To7Bytes(4L, unsignedInt, unsignedInt); return finalize(hash); }
@Override public long hashByte(byte input) { long h = (seed() + k2) * k0; h += Primitives.unsignedByte(input) * k3; h ^= Long.rotateRight(h, 37) * k1; return MetroHash.finalize(h); }
<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; }
@Override public long hashByte(byte input) { long hash = seed() + P5 + 1; hash ^= Primitives.unsignedByte(input) * P5; hash = Long.rotateLeft(hash, 11) * P1; return XxHash.finalize(hash); }
k1 ^= ((long) access.getUnsignedByte(input, offset + 4L)) << 32; // fall through case 4: k1 ^= Primitives.unsignedInt(fetch32(access, input, offset)); break; case 3:
@Override public long hashShort(short input) { input = NATIVE_XX.toLittleEndian(input); long hash = seed() + P5 + 2; hash ^= Primitives.unsignedByte(input) * P5; hash = Long.rotateLeft(hash, 11) * P1; hash ^= Primitives.unsignedByte(input >> 8) * P5; hash = Long.rotateLeft(hash, 11) * P1; return XxHash.finalize(hash); }