Skip to content

Commit f698a0d

Browse files
Update BloomFilter.cpp
1 parent 575ca49 commit f698a0d

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/Interpreters/BloomFilter.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,13 +61,13 @@ bool BloomFilter::find(const char * data, size_t len)
6161
size_t hash1 = CityHash_v1_0_2::CityHash64WithSeed(data, len, seed);
6262
size_t hash2 = CityHash_v1_0_2::CityHash64WithSeed(data, len, SEED_GEN_A * seed + SEED_GEN_B);
6363

64-
// acc = hash1 + hash2 * i
6564
size_t acc = hash1;
6665

6766
for (size_t i = 0; i < hashes; ++i)
6867
{
69-
// pos = (hash1 + hash2*i + i*i) % (8 * size)
70-
size_t pos = fastMod(acc + i*i);
68+
/// It accumulates in the loop as follows:
69+
/// pos = (hash1 + hash2 * i + i * i) % (8 * size)
70+
size_t pos = fastMod(acc + i * i);
7171
if (!(filter[pos / word_bits] & (1ULL << (pos % word_bits))))
7272
return false;
7373
acc += hash2;
@@ -85,8 +85,8 @@ void BloomFilter::add(const char * data, size_t len)
8585

8686
for (size_t i = 0; i < hashes; ++i)
8787
{
88-
// pos = (hash1 + hash2*i + i*i) % (8 * size)
89-
size_t pos = fastMod(acc + i*i);
88+
// pos = (hash1 + hash2 * i + i * i) % (8 * size)
89+
size_t pos = fastMod(acc + i * i);
9090
filter[pos / word_bits] |= (1ULL << (pos % word_bits));
9191
acc += hash2;
9292
}

0 commit comments

Comments
 (0)