mirror of
https://github.com/servo/servo.git
synced 2025-08-05 05:30:08 +01:00
Be smarter when clearing the bloom filter.
This commit is contained in:
parent
28c35ac9df
commit
71e76a054d
2 changed files with 32 additions and 1 deletions
|
@ -108,6 +108,18 @@ impl BloomFilter {
|
|||
self.counters = [0; ARRAY_SIZE]
|
||||
}
|
||||
|
||||
// Slow linear accessor to make sure the bloom filter is zeroed. This should
|
||||
// never be used in release builds.
|
||||
#[cfg(debug_assertions)]
|
||||
pub fn is_zeroed(&self) -> bool {
|
||||
self.counters.iter().all(|x| *x == 0)
|
||||
}
|
||||
|
||||
#[cfg(not(debug_assertions))]
|
||||
pub fn is_zeroed(&self) -> bool {
|
||||
unreachable!()
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn insert_hash(&mut self, hash: u32) {
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue