Trait compacts_bits::Rank [] [src]

pub trait Rank<T: UnsignedInt> {
    type Weight;

    const SIZE: Self::Weight;

    fn rank1(&self, i: T) -> Self::Weight;
    fn rank0(&self, i: T) -> Self::Weight;
}

Associated Types

Hamming Weight or Population Count.

Associated Constants

SIZE: Self::Weight

Required Methods

Returns occurences of non-zero bit in 0...i. It's equivalent to i+1 - self.rank0(i).

Returns occurences of zero bit in 0...i. It's equivalent to i+1 - self.rank1(i).

Implementors