We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent bf7dc7a commit 50231ffCopy full SHA for 50231ff
bloom.js
@@ -44,6 +44,7 @@ JSBloom.filter = function(items, target_prob) {
44
45
var h1 = hashes.djb2(str)
46
var h2 = hashes.sdbm(str)
47
+ var added = false
48
for (var round = 0; round <= HASH_ROUNDS; round++) {
49
var new_hash = round == 0 ? h1
50
: round == 1 ? h2
@@ -54,13 +55,15 @@ JSBloom.filter = function(items, target_prob) {
54
55
56
if (extra_indices != 0 && (bVector[index] & (128 >> (extra_indices - 1))) == 0) {
57
bVector[index] ^= (128 >> extra_indices - 1);
58
+ added = true;
59
} else if (extra_indices == 0 && (bVector[index] & 1) == 0) {
60
bVector[index] ^= 1;
61
62
}
63
64
};
65
- return true;
66
+ return added;
67
68
69
addEntries = function(arr) {
0 commit comments