pub trait BitVector {
    fn get(&self, i: usize) -> bool;
    fn set(&mut self, i: usize, x: bool);
    fn size(&self) -> usize;

    fn rank(&self, r: Range<usize>) -> usize { ... }
    fn select(&self, n: usize, start: usize) -> Option<usize> { ... }
    fn get_range(&self, r: Range<usize>) -> u128 { ... }
    fn set_range(&mut self, r: Range<usize>, x: u128) { ... }
    fn clear_range(&mut self, r: Range<usize>) { ... }
}
Expand description

A basic bitvector trait that we implement for mmap

Required Methods

Get the value at bit i

Set the value at bit i

Returns the size of the bitvector

Provided Methods

Returns the number of bits sets in the given range

Returns the position of the n-th set bit

Return all the bits in the given range as a u128. The input range r must span <= 128, as the result is bitpacked into a u128.

For example, an input range of (0, 7) will set the first 8 bits of the returned u128 to the result of self.get(0, 1, ... 7).

Sets all the bits in the given range from the given u128

Sets all the bit in the given range to false

Implementations on Foreign Types

Implementors