package containers
Install
Dune Dependency
Authors
Maintainers
Sources
md5=03b80e963186e91ddac62ef645bf7fb2
sha512=c8f434808be540c16926bf03d89f394d33fc2d092f963a7b6d412481229e0a96290f1ad7c7d522415115d35426b7aa0b3fda4b991ddc321dad279d402c9a0c0b
doc/containers.data/CCBV/index.html
Module CCBV
Source
Imperative Bitvectors
BREAKING CHANGES since 1.2: size is now stored along with the bitvector. Some functions have a new signature.
The size of the bitvector used to be rounded up to the multiple of 30 or 62. In other words some functions such as iter
would iterate on more bits than what was originally asked for. This is not the case anymore.
A resizable bitvector
Size of underlying bitvector. This is not related to the underlying implementation. Changed at 1.2
Resize the BV so that it has the specified length. This can grow or shrink the underlying bitvector.
Same as to_list
, but also guarantees the list is sorted in increasing order.
From a list of true bits.
The bits are interpreted as indices into the returned bitvector, so the final bitvector will have length t
equal to 1 more than max of list indices.
filter bv p
only keeps the true bits of bv
whose index
satisfies p index
.
union_into ~into bv
sets into
to the union of itself and bv
. Also updates the length of into
to be at least length bv
.
inter_into ~into bv
sets into
to the intersection of itself and bv
. Also updates the length of into
to be at most length bv
.
diff_into ~into t
modifies into
with only the bits set but not in t
.
select arr bv
selects the elements of arr
whose index corresponds to a true bit in bv
. If bv
is too short, elements of arr
with too high an index cannot be selected and are therefore not selected.
Same as select
, but selected elements are paired with their indexes.
Print the bitvector as a string of bits.