package extlib
Install
Dune Dependency
Authors
Maintainers
Sources
md5=2c620993aecd4b31b3a362b21b55dd94
sha256=4183abeca72efefc2513a440706c0e6e56d4676f60ae89a4306f8e5e03fbb5eb
sha512=4f3d6f5bc29c43254ad9f927213fca4afb8a74afbfbaca01ae7e540ea4509f2583aeedd91da8d5252843dd0998093e6e02801a4e95a70a04c6f7229b2b817bf3
doc/extlib/BitSet/index.html
Module BitSet
Efficient bit sets.
A bitset is an array of boolean values that can be accessed with indexes like an array but provides a better memory usage (divided by 8) for a very small speed trade-off.
When a negative bit value is used for one of the BitSet functions, this exception is raised with the name of the function.
val empty : unit -> t
Create an empty bitset of size 0, the bitset will automatically expand when needed.
val create : int -> t
Create an empty bitset with an initial size (in number of bits).
val set : t -> int -> unit
set s n
sets the nth-bit in the bitset s
to true.
val unset : t -> int -> unit
unset s n
sets the nth-bit in the bitset s
to false.
val put : t -> bool -> int -> unit
put s v n
sets the nth-bit in the bitset s
to v
.
val toggle : t -> int -> unit
toggle s n
changes the nth-bit value in the bitset s
.
val is_set : t -> int -> bool
is_set s n
returns true if nth-bit in the bitset s
is set, or false otherwise.
compare s1 s2
compares two bitsets. Highest bit indexes are compared first.
equals s1 s2
returns true if, and only if, all bits values in s1 are the same as in s2.
val count : t -> int
count s
returns the number of bits set in the bitset s
.
differentiate_sym s t
sets s
to the symmetrical difference of the sets s
and t
.