Skip to content

Commit

Permalink
Bloom filters untested for large (500M) inputs #22
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasmueller committed Jan 19, 2020
1 parent 1150b61 commit 71781a0
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions fastfilter/src/main/java/org/fastfilter/bloom/Bloom.java
Original file line number Diff line number Diff line change
Expand Up @@ -50,21 +50,21 @@ public boolean supportsAdd() {
@Override
public void add(long key) {
long hash = Hash.hash64(key, seed);
int a = (int) (hash >>> 32);
int b = (int) hash;
long a = (hash >>> 32) | (hash << 32);
long b = hash;
for (int i = 0; i < k; i++) {
data[Hash.reduce(a, arraySize)] |= 1L << a;
data[Hash.reduce((int) (a >>> 32), arraySize)] |= 1L << a;
a += b;
}
}

@Override
public boolean mayContain(long key) {
long hash = Hash.hash64(key, seed);
int a = (int) (hash >>> 32);
int b = (int) hash;
long a = (hash >>> 32) | (hash << 32);
long b = hash;
for (int i = 0; i < k; i++) {
if ((data[Hash.reduce(a, arraySize)] & 1L << a) == 0) {
if ((data[Hash.reduce((int) (a >>> 32), arraySize)] & 1L << a) == 0) {
return false;
}
a += b;
Expand Down

0 comments on commit 71781a0

Please sign in to comment.