Skip to content

Commit ea80a7d

Browse files
reverting unrelated changes
1 parent 3043598 commit ea80a7d

File tree

2 files changed

+10
-13
lines changed

2 files changed

+10
-13
lines changed

fastfilter/src/main/java/org/fastfilter/utils/Hash.java

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,10 @@
22

33
import java.util.Random;
44

5-
public final class Hash {
6-
private Hash() {
7-
8-
}
9-
5+
public class Hash {
106
private static final Random random = new Random();
117

128
public static void setSeed(long seed) {
13-
// shouldn't we use ThreadLocalRandom.current() instead?
149
random.setSeed(seed);
1510
}
1611

@@ -27,7 +22,7 @@ public static long randomSeed() {
2722
}
2823

2924
/**
30-
* Shrink the hash to value 0..n. Kind of like modulo, but using
25+
* Shrink the hash to a value 0..n. Kind of like modulo, but using
3126
* multiplication and shift, which are faster to compute.
3227
*
3328
* @param hash the hash
@@ -41,7 +36,7 @@ public static int reduce(int hash, int n) {
4136

4237
/**
4338
* Multiply two unsigned 64-bit values.
44-
* See <a href="https://bugs.java.com/bugdatabase/view_bug.do?bug_id=8188044">JDK-8188044</a>
39+
* See https://bugs.java.com/bugdatabase/view_bug.do?bug_id=8188044
4540
*
4641
* @param a the first value
4742
* @param b the second value

fastfilter/src/main/java/org/fastfilter/xor/XorBinaryFuse16.java

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
package org.fastfilter.xor;
22

3-
import java.lang.reflect.Constructor;
43
import java.nio.ByteBuffer;
54
import java.util.Arrays;
6-
75
import org.fastfilter.Filter;
86
import org.fastfilter.utils.Hash;
97

@@ -61,7 +59,7 @@ static int calculateSegmentLength(int arity, int size) {
6159
}
6260

6361
static double calculateSizeFactor(int arity, int size) {
64-
final double sizeFactor;
62+
double sizeFactor;
6563
if (arity == 3) {
6664
sizeFactor = Math.max(1.125, 0.875 + 0.25 * Math.log(1000000) / Math.log(size));
6765
} else if (arity == 4) {
@@ -151,7 +149,8 @@ private void addAll(long[] keys) {
151149
countMask |= t2count[index];
152150
}
153151
}
154-
if (countMask < 0) {
152+
startPos = null;
153+
if (countMask < 0) {
155154
// we have a possible counter overflow
156155
continue mainloop;
157156
}
@@ -216,7 +215,10 @@ private void addAll(long[] keys) {
216215
seed = Hash.randomSeed();
217216
}
218217

219-
for (int i = reverseOrderPos - 1; i >= 0; i--) {
218+
alone = null;
219+
t2count = null;
220+
t2hash = null;
221+
for (int i = reverseOrderPos - 1; i >= 0; i--) {
220222
long hash = reverseOrder[i];
221223
int found = reverseH[i];
222224
short xor2 = fingerprint(hash);

0 commit comments

Comments
 (0)