Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement BloomFilter class #10846

Merged
merged 18 commits into from
Feb 28, 2023
Prev Previous commit
Next Next commit
Update bloom_filter.h
  • Loading branch information
milaGGL committed Feb 22, 2023
commit 61c7e8229d08b379207221786d0f88a4849d1244
16 changes: 8 additions & 8 deletions Firestore/core/src/remote/bloom_filter.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,14 @@ class BloomFilter final {
return bit_count_;
}

// When checking membership of a key in bitmap, the first step is to generate
// a 128-bit hash, and treat it as 2 distinct 64-bit hash values, named `h1`
// and `h2`, interpreted as unsigned integers using 2's complement encoding.
struct Hash {
dconeybe marked this conversation as resolved.
Show resolved Hide resolved
uint64_t h1;
uint64_t h2;
};

private:
// The number of bits in the bloom filter. Guaranteed to be non-negative, and
// less than the max number of bits `bitmap_` can represent, i.e.,
Expand All @@ -71,14 +79,6 @@ class BloomFilter final {
int32_t bit_count) const;

bool IsBitSet(const std::vector<uint8_t>& bitmap, int32_t index) const;
dconeybe marked this conversation as resolved.
Show resolved Hide resolved

// When checking membership of a key in bitmap, the first step is to generate
// a 128-bit hash, and treat it as 2 distinct 64-bit hash values, named `h1`
// and `h2`, interpreted as unsigned integers using 2's complement encoding.
struct Hash {
uint64_t h1;
uint64_t h2;
};
};

} // namespace remote
Expand Down