Module std::bit_vector
- Struct
BitVector
- Constants
- Function
new
- Function
set
- Function
unset
- Function
shift_left
- Function
is_index_set
- Function
length
- Function
longest_set_sequence_starting_at
Struct BitVector
public struct BitVector has copy, drop, store
Click to open
Fields
Constants
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;
Function new
public fun new(length: u64): std::bit_vector::BitVector
Click to open
Implementation
Function set
Set the bit at bit_index in the bitvector regardless of its previous state.
public fun set(bitvector: &mut std::bit_vector::BitVector, bit_index: u64)
Click to open
Implementation
Function unset
Unset the bit at bit_index in the bitvector regardless of its previous state.
public fun unset(bitvector: &mut std::bit_vector::BitVector, bit_index: u64)
Click to open
Implementation
Function shift_left
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 std::bit_vector::BitVector, amount: u64)
Click to open
Implementation
Function is_index_set
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: &std::bit_vector::BitVector, bit_index: u64): bool
Click to open
Implementation
Function length
Return the length (number of usable bits) of this bitvector
public fun length(bitvector: &std::bit_vector::BitVector): u64
Click to open
Implementation
Function longest_set_sequence_starting_at
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: &std::bit_vector::BitVector, start_index: u64): u64
Click to open