public final class PhiMix
extends java.lang.Object
Those methods mixes the bits of the argument by multiplying by the golden ratio and xorshifting the result.
It is borrowed from Koloboke, and it has slightly
worse behaviour than MurmurHash3 (in open-addressing hash tables the
average number of probes is slightly larger), but it's much faster.
Reciprocal mixing functions are borrowed from fastutil.
| Modifier and Type | Field and Description |
|---|---|
static int |
HASH_0
= hash((int)0)
|
static int |
HASH_1
= hash((int)1)
|
| Modifier and Type | Method and Description |
|---|---|
static int |
invMix32(int x)
The inverse of
mix32(int). |
static long |
invMix64(long x)
The inverse of
mix64(long). |
static int |
mix32(int x)
Hashes a 4-byte sequence (Java int).
|
static long |
mix64(long x)
Hashes an 8-byte sequence (Java long).
|
public static final int HASH_0
public static final int HASH_1
public static int mix32(int x)
x - an integer.x.public static int invMix32(int x)
mix32(int). This method is mainly useful to create
unit tests.x - an integer.mix32(int) would give x
.public static long mix64(long x)
x - a long integer.x.public static long invMix64(long x)
mix64(long). This method is mainly useful to create
unit tests.x - a long integer.mix64(long) would give
x.Copyright © 2017. All rights reserved.