| 102 | } |
| 103 | |
| 104 | void BloomFilter::add(const uint8_t *item, int length) { |
| 105 | auto hashValues = hash(item, length); |
| 106 | |
| 107 | for (uint8_t n = 0; n < impData.m_numHashes; n++) { |
| 108 | auto bitPos = nthHash(n, hashValues[0], hashValues[1], impData.length); |
| 109 | store.setBit(bitPos); |
| 110 | } |
| 111 | |
| 112 | impData.addedCount++; |
| 113 | } |
| 114 | |
| 115 | bool BloomFilter::possiblyContains(const uint8_t *item, int length) const { |
| 116 | auto hashValues = hash(item, length); |