sile / scalable_cuckoo_filter

A variant of Cuckoo Filter whose size automatically scales as necessary
MIT License
17 stars 7 forks source link

Question: How do you promise the fingerprint isn't `0`? #12

Closed ashtul closed 5 months ago

ashtul commented 6 months ago

In the code I see only this function - `

pub fn fingerprint(&self, hash: u64) -> u64 {
    hash >> (64 - self.fingerprint_bitwidth)
}

Than there an assert for 0 value. debug_assert_ne!(fingerprint, 0);

But it does not promise a non 0 reply. Am I missing something?

sile commented 6 months ago

The calling side guarantees that the conditions are met as follows:

If you have a specific scenario in which the assertion could be broken, it may indicate a bug, so please inform me.

ashtul commented 5 months ago

Got it. Thank you!