Skip to content

Commit 7325dac

Browse files
committed
reuse hash
1 parent 7b12699 commit 7325dac

File tree

2 files changed

+3
-11
lines changed

2 files changed

+3
-11
lines changed

server/src/main/java/org/elasticsearch/common/hash/MurmurHash3.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ static class IntermediateResult {
8181
private static long C1 = 0x87c37b91114253d5L;
8282
private static long C2 = 0x4cf5ad432745937fL;
8383

84-
protected static long fmix(long k) {
84+
public static long fmix(long k) {
8585
k ^= k >>> 33;
8686
k *= 0xff51afd7ed558ccdL;
8787
k ^= k >>> 33;

test/framework/src/main/java/org/elasticsearch/test/MixWithIncrement.java

+2-10
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
import com.carrotsearch.randomizedtesting.SeedDecorator;
1313

1414
import org.elasticsearch.common.Randomness;
15+
import org.elasticsearch.common.hash.MurmurHash3;
1516

1617
import java.util.concurrent.atomic.AtomicLong;
1718

@@ -59,15 +60,6 @@ public long decorate(long seed) {
5960
}
6061

6162
public static void next() {
62-
mix.updateAndGet(MixWithIncrement::fmix64);
63-
}
64-
65-
private static long fmix64(long k) {
66-
k ^= k >>> 33;
67-
k *= -49064778989728563L;
68-
k ^= k >>> 33;
69-
k *= -4265267296055464877L;
70-
k ^= k >>> 33;
71-
return k;
63+
mix.updateAndGet(MurmurHash3::fmix);
7264
}
7365
}

0 commit comments

Comments
 (0)