mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
selectors: Unbust tests, and add a way to override the hash for the bloom filter.
This commit is contained in:
parent
e0731215c0
commit
65ebbb7c56
3 changed files with 7 additions and 6 deletions
|
@ -106,7 +106,7 @@ impl BloomFilter {
|
|||
}
|
||||
|
||||
#[inline]
|
||||
fn insert_hash(&mut self, hash: u32) {
|
||||
pub fn insert_hash(&mut self, hash: u32) {
|
||||
{
|
||||
let slot1 = self.first_mut_slot(hash);
|
||||
if !full(slot1) {
|
||||
|
@ -125,11 +125,10 @@ impl BloomFilter {
|
|||
#[inline]
|
||||
pub fn insert<T: Hash>(&mut self, elem: &T) {
|
||||
self.insert_hash(hash(elem))
|
||||
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn remove_hash(&mut self, hash: u32) {
|
||||
pub fn remove_hash(&mut self, hash: u32) {
|
||||
{
|
||||
let slot1 = self.first_mut_slot(hash);
|
||||
if !full(slot1) {
|
||||
|
@ -151,7 +150,7 @@ impl BloomFilter {
|
|||
}
|
||||
|
||||
#[inline]
|
||||
fn might_contain_hash(&self, hash: u32) -> bool {
|
||||
pub fn might_contain_hash(&self, hash: u32) -> bool {
|
||||
*self.first_slot(hash) != 0 && *self.second_slot(hash) != 0
|
||||
}
|
||||
|
||||
|
@ -170,7 +169,6 @@ fn full(slot: &u8) -> bool {
|
|||
*slot == 0xff
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn hash<T: Hash>(elem: &T) -> u32 {
|
||||
let mut hasher = FnvHasher::default();
|
||||
elem.hash(&mut hasher);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue