public static long hash(long value) { long hash = DEFAULT_SEED + PRIME64_5 + SizeOf.SIZE_OF_LONG; hash = updateTail(hash, value); hash = finalShuffle(hash); return hash; }
public static long hash(long value) { long hash = DEFAULT_SEED + PRIME64_5 + SizeOf.SIZE_OF_LONG; hash = updateTail(hash, value); hash = finalShuffle(hash); return hash; }
private static long updateTail(long hash, Object base, long address, int index, int length) { while (index <= length - 8) { hash = updateTail(hash, unsafe.getLong(base, address + index)); index += 8; } if (index <= length - 4) { hash = updateTail(hash, unsafe.getInt(base, address + index)); index += 4; } while (index < length) { hash = updateTail(hash, unsafe.getByte(base, address + index)); index++; } hash = finalShuffle(hash); return hash; }
private static long updateTail(long hash, Object base, long address, int index, int length) { while (index <= length - 8) { hash = updateTail(hash, unsafe.getLong(base, address + index)); index += 8; } if (index <= length - 4) { hash = updateTail(hash, unsafe.getInt(base, address + index)); index += 4; } while (index < length) { hash = updateTail(hash, unsafe.getByte(base, address + index)); index++; } hash = finalShuffle(hash); return hash; }