@Override public <T> long hash(T input, Access<T> access, long off, long len) { CityAndFarmHash_1_1 instance = access.byteOrder(input) == LITTLE_ENDIAN ? CityAndFarmHash_1_1.INSTANCE : BigEndian.INSTANCE; if (len <= 64) { return instance.naHash64(access, input, off, len); } return instance.uoHash64WithSeeds(access, input, off, len, 81, 0); } }
@Override public <T> long hash(T input, Access<T> access, long off, long len) { if (access.byteOrder(input) == LITTLE_ENDIAN) { return CityAndFarmHash_1_1.INSTANCE.uoHash64WithSeeds( access, input, off, len, seed0, seed1); } else { return BigEndian.INSTANCE.uoHash64WithSeeds(access, input, off, len, seed0, seed1); } } }
@Override public <T> long hash(T input, Access<T> access, long off, long len) { long seed = seed(); if (access.byteOrder(input) == LITTLE_ENDIAN) { return MurmurHash_3.INSTANCE.hash(seed, input, access, off, len); } else { return BigEndian.INSTANCE.hash(seed, input, access, off, len); } } }
@Override public <T> long hash(T input, Access<T> access, long off, long len) { long seed = seed(); if (access.byteOrder(input) == LITTLE_ENDIAN) { return XxHash.INSTANCE.xxHash64(seed, input, access, off, len); } else { return BigEndian.INSTANCE.xxHash64(seed, input, access, off, len); } } }
@Override public <T> long hash(T input, Access<T> access, long off, long len) { long hash; if (access.byteOrder(input) == LITTLE_ENDIAN) { hash = CityAndFarmHash_1_1.INSTANCE.naHash64(access, input, off, len); } else { hash = BigEndian.INSTANCE.naHash64(access, input, off, len); } return finalize(hash); } }
@Override public <T> long hash(T input, Access<T> access, long off, long len) { long seed = seed(); if (access.byteOrder(input) == LITTLE_ENDIAN) { return MetroHash.INSTANCE.metroHash64(seed, input, access, off, len); } else { return MetroHash.BigEndian.INSTANCE.metroHash64(seed, input, access, off, len); } } }
@Override public <T> long hash(T input, Access<T> access, long off, long len) { long hash; if (access.byteOrder(input) == LITTLE_ENDIAN) { hash = CityAndFarmHash_1_1.INSTANCE.cityHash64(access, input, off, len); } else { hash = BigEndian.INSTANCE.cityHash64(access, input, off, len); } return finalize(hash); }
@Override public <T> long hash(T input, Access<T> access, long off, long len) { CityAndFarmHash_1_1 instance = access.byteOrder(input) == LITTLE_ENDIAN ? CityAndFarmHash_1_1.INSTANCE : BigEndian.INSTANCE; if (len <= 64) { return finalize(instance.naHash64(access, input, off, len)); } return instance.uoHash64WithSeeds(access, input, off, len, 0, seed1); } }
/** * Shortcut for {@code getShort(input, offset) & 0xFFFF}. Could be implemented more * efficiently. * * @param input the object to access * @param offset offset to the first byte to read within the byte sequence represented * by the given object * @return two bytes as an unsigned short value, in {@linkplain #byteOrder(Object) the expected * order} */ public int getUnsignedShort(T input, long offset) { if (byteOrder(input) == LITTLE_ENDIAN) { return getUnsignedByte(input, offset) | (getUnsignedByte(input, offset + 1L) << 8); } else { return getUnsignedByte(input, offset + 1L) | (getUnsignedByte(input, offset) << 8); } }
/** * Reads {@code [offset, offset + 7]} bytes of the byte sequence represented by the given * {@code input} as a single {@code long} value. * * @param input the object to access * @param offset offset to the first byte to read within the byte sequence represented * by the given object * @return eight bytes as a {@code long} value, in {@linkplain #byteOrder(Object) the expected * order} */ public long getLong(T input, long offset) { if (byteOrder(input) == LITTLE_ENDIAN) { return getUnsignedInt(input, offset) | (getUnsignedInt(input, offset + 4L) << 32); } else { return getUnsignedInt(input, offset + 4L) | (getUnsignedInt(input, offset) << 32); } }
/** * Reads {@code [offset, offset + 3]} bytes of the byte sequence represented by the given * {@code input} as a single {@code int} value. * * @param input the object to access * @param offset offset to the first byte to read within the byte sequence represented * by the given object * @return four bytes as an {@code int} value, in {@linkplain #byteOrder(Object) the expected * order} */ public int getInt(T input, long offset) { if (byteOrder(input) == LITTLE_ENDIAN) { return getUnsignedShort(input, offset) | (getUnsignedShort(input, offset + 2L) << 16); } else { return getUnsignedShort(input, offset + 2L) | (getUnsignedShort(input, offset) << 16); } }