Trait compacts::bits::Rank
[−]
[src]
pub trait Rank<T> { fn rank1(&self, i: T) -> T; fn rank0(&self, i: T) -> T
where
T: Sub<Output = T> + Copy, { ... } }
Rank
is a generalization of PopCount
.
Required Methods
fn rank1(&self, i: T) -> T
Returns occurences of non-zero bit in [0, i)
.
rank1(i)
should be equal to i - self.rank0(i)
.
Provided Methods
fn rank0(&self, i: T) -> T where
T: Sub<Output = T> + Copy,
T: Sub<Output = T> + Copy,
Returns occurences of zero bit in [0, i)
.
rank0(i)
should be equal to i - self.rank1(i)
.