Modification of Bit Manipulation in Bloom Filter
- Dominant language
- C++
- Stars
- 39.4k
- Forks
- 8.2k
- PR merge metrics
- No merged PRs in 30d
Description
File: util/bloom.cc
Line: 50: array[bitpos / 8] |= (1 << (bitpos % 8));
This line sets the bit at position n by shifting 1 left by the remainder of n divided by 8. However, it does not set the nth bit directly; instead, it sets the bit at position (n / 8) * 8 + (8 - n % 8).
According to standard Bloom filter logic, we should set the nth bit (where n is calculated by hashing the key). While the current implementation functions correctly, aligning with traditional Bloom filter logic could enhance clarity. However, if this is changed to align with the original implementation of Bloom filters, existing databases may encounter issues such as data loss or incorrect results.
Contributor guide
Assessment
This issue has not been assessed yet.