pub fn add(&mut self, obj: &T) {
        let mut hasher = self.buildhasher.build_hasher();
        obj.hash(&mut hasher);
        let h: u64 = hasher.finish();

        // split h into:
        //  - w = 64 - b upper bits
        //  - j = b lower bits
        let w = h >> self.b;
        let j = h - (w << self.b); // no 1 as in the paper since register indices are 0-based

        // p = leftmost bit (1-based count)
        let p = w.leading_zeros() + 1 - (self.b as u32);

        let m_old = self.registers[j as usize];
        self.registers[j as usize] = cmp::max(m_old, p as u8);
    }
/// Adds an element to the HyperLogLog.
Adds an element to the HyperLogLog.
Adds an element to the HyperLogLog .
pub fn add(&mut self, obj: &T) {
        let mut hasher = self.buildhasher.build_hasher();
        obj.hash(&mut hasher);
        let h: u64 = hasher.finish();
        // split h into:
        //  - w = 64 - b upper bits
        //  - j = b lower bits
        let w = h >> self.b;
        let j = h - (w << self.b); // no 1 as in the paper since register indices are 0-based
        // p = leftmost bit (1-based count)
        let p = w.leading_zeros() + 1 - (self.b as u32);
        let m_old = self.registers[j as usize];
        self.registers[j as usize] = cmp::max(m_old, p as u8);
    }
pub fn add ( & mut self , obj : & T ) { let mut hasher = self . buildhasher . build_hasher ( ) ; obj . hash ( & mut hasher ) ; let h : u64 = hasher . finish ( ) ; // split h into: //  - w = 64 - b upper bits //  - j = b lower bits let w = h >> self . b ; let j = h - ( w << self . b ) ; // no 1 as in the paper since register indices are 0-based // p = leftmost bit (1-based count) let p = w . leading_zeros ( ) + 1 - ( self . b as u32 ) ; let m_old = self . registers [ j as usize ] ; self . registers [ j as usize ] = cmp :: max ( m_old , p as u8 ) ; }
Adds an element to the HyperLogLog.
Adds an element to the HyperLogLog .
&mut self
obj
&T
&mut self
obj
&T