/// Creates a new `BitArray` with the given
/// bits per value and capacity. The array
/// will be initialized with zeroes.
Creates a new `BitArray` with the given
bits per value and capacity. The array
will be initialized with zeroes.
Creates a new ` BitArray ` with the given bits per value and capacity . The array will be initialized with zeroes .
pub fn new(bits_per_value: u8, capacity: usize) -> Self {
        assert!(
            bits_per_value <= 64,
            "Bits per value cannot be more than 64"
        );
        assert!(bits_per_value > 0, "Bits per value must be positive");
        let data = {
            let len = (((capacity * (bits_per_value as usize)) as f64) / 64.0).ceil() as usize;
            vec![0u64; len]
        };
        let value_mask = (1 << (bits_per_value as u64)) - 1;
        Self {
            data,
            capacity,
            bits_per_value,
            value_mask,
        }
    }
pub fn new ( bits_per_value : u8 , capacity : usize ) -> Self { assert ! ( bits_per_value 64 " " ) ; assert ! ( bits_per_value 0 " " ) ; let data = { let len = ( ( ( capacity * ( bits_per_value as usize ) ) as f64 ) / 64.0 ) . ceil ( ) as usize ; vec ! [ 0u64 len ] } ; let value_mask = ( 1 << ( bits_per_value as u64 ) ) - 1 ; Self { data , capacity , bits_per_value , value_mask , } }
Creates a new `BitArray` with the given
bits per value and capacity.
Creates a new ` BitArray ` with the given bits per value and capacity .
bits_per_value
u8
capacity
usize