Skip to content

Commit 71781a0

Browse files
committed
Bloom filters untested for large (500M) inputs #22
1 parent 1150b61 commit 71781a0

File tree

1 file changed

+6
-6
lines changed
  • fastfilter/src/main/java/org/fastfilter/bloom

1 file changed

+6
-6
lines changed

fastfilter/src/main/java/org/fastfilter/bloom/Bloom.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,21 +50,21 @@ public boolean supportsAdd() {
5050
@Override
5151
public void add(long key) {
5252
long hash = Hash.hash64(key, seed);
53-
int a = (int) (hash >>> 32);
54-
int b = (int) hash;
53+
long a = (hash >>> 32) | (hash << 32);
54+
long b = hash;
5555
for (int i = 0; i < k; i++) {
56-
data[Hash.reduce(a, arraySize)] |= 1L << a;
56+
data[Hash.reduce((int) (a >>> 32), arraySize)] |= 1L << a;
5757
a += b;
5858
}
5959
}
6060

6161
@Override
6262
public boolean mayContain(long key) {
6363
long hash = Hash.hash64(key, seed);
64-
int a = (int) (hash >>> 32);
65-
int b = (int) hash;
64+
long a = (hash >>> 32) | (hash << 32);
65+
long b = hash;
6666
for (int i = 0; i < k; i++) {
67-
if ((data[Hash.reduce(a, arraySize)] & 1L << a) == 0) {
67+
if ((data[Hash.reduce((int) (a >>> 32), arraySize)] & 1L << a) == 0) {
6868
return false;
6969
}
7070
a += b;

0 commit comments

Comments
 (0)