Fix broken IdGeneratorTest
Change-Id: I6d83c3a4248344a25f2d188cf17da8db0efa37d2
This commit is contained in:
@@ -43,11 +43,15 @@ public class IdGenerator {
|
|||||||
|
|
||||||
/** Produce the next identifier. */
|
/** Produce the next identifier. */
|
||||||
public int next() {
|
public int next() {
|
||||||
return mix(salt, gen.getAndIncrement());
|
return mix(gen.getAndIncrement());
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final int salt = 0x9e3779b9;
|
private static final int salt = 0x9e3779b9;
|
||||||
|
|
||||||
|
static int mix(int in) {
|
||||||
|
return mix(salt, in);
|
||||||
|
}
|
||||||
|
|
||||||
/** A very simple bit permutation to mask a simple incrementer. */
|
/** A very simple bit permutation to mask a simple incrementer. */
|
||||||
public static int mix(final int salt, final int in) {
|
public static int mix(final int salt, final int in) {
|
||||||
short v0 = hi16(in);
|
short v0 = hi16(in);
|
||||||
|
|||||||
Reference in New Issue
Block a user