- Struct
BitVector
- Constants
- Function
new
- Function
set
- Function
unset
- Function
shift_left
- Function
is_index_set
- Function
length
- Function
longest_set_sequence_starting_at
- Function
shift_left_for_verification_only
struct BitVector has copy, drop, store
The provided index is out of bounds
const EINDEX: u64 = 131072;
An invalid length of bitvector was given
const ELENGTH: u64 = 131073;
The maximum allowed bitvector size
const MAX_SIZE: u64 = 1024;
const WORD_SIZE: u64 = 1;
public fun new(length: u64): bit_vector::BitVector
Set the bit at bit_index
in the bitvector
regardless of its previous state.
public fun set(bitvector: &mut bit_vector::BitVector, bit_index: u64)
Unset the bit at bit_index
in the bitvector
regardless of its previous state.
public fun unset(bitvector: &mut bit_vector::BitVector, bit_index: u64)
Shift the bitvector
left by amount
. If amount
is greater than the
bitvector's length the bitvector will be zeroed out.
public fun shift_left(bitvector: &mut bit_vector::BitVector, amount: u64)
Return the value of the bit at bit_index
in the bitvector
. true
represents "1" and false
represents a 0
public fun is_index_set(bitvector: &bit_vector::BitVector, bit_index: u64): bool
Return the length (number of usable bits) of this bitvector
public fun length(bitvector: &bit_vector::BitVector): u64
Returns the length of the longest sequence of set bits starting at (and
including) start_index
in the bitvector
. If there is no such
sequence, then 0
is returned.
public fun longest_set_sequence_starting_at(bitvector: &bit_vector::BitVector, start_index: u64): u64
#[verify_only]
public fun shift_left_for_verification_only(bitvector: &mut bit_vector::BitVector, amount: u64)