bloom-bitset 11.1.0

Zero-dependency probabilistic data structures: 512-bit cache-line-blocked Bloom filter, 4-bit saturating Counting Bloom filter, and HyperLogLog cardinality estimator.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use super::*;

/// Single 64-byte cache-line-aligned 512-bit Bloom block.
#[repr(align(64))]
#[derive(Clone, Copy, Debug, Default, Eq, PartialEq)]
pub(crate) struct BloomBlock {
    /// Eight 64-bit bitset words totaling 512 bits.
    pub(crate) words: [u64; BLOCK_WORDS],
}

/// Cache-line-blocked Bloom filter where every lookup and insert touches at most one 64-byte cache line.
#[derive(Clone, Debug, Eq, PartialEq)]
pub struct BlockedBloomFilter {
    /// Vector of 512-bit cache-line-aligned blocks.
    pub(crate) blocks: Vec<BloomBlock>,
    /// Number of hash probes applied inside the selected 512-bit block (`1..=16`).
    pub(crate) hash_count: u32,
}