mirror of
https://github.com/c-cube/ocaml-containers.git
synced 2025-12-06 11:15:31 -05:00
feat(BV): add set_bool
This commit is contained in:
parent
3d57a5c86e
commit
3960ea3792
2 changed files with 7 additions and 0 deletions
|
|
@ -279,6 +279,9 @@ let[@inline] reset bv i =
|
|||
let bv = create ~size:3 false in set bv 0; reset bv 0; not (get bv 0)
|
||||
*)
|
||||
|
||||
let[@inline] set_bool bv i b =
|
||||
if b then set bv i else reset bv i
|
||||
|
||||
let flip bv i =
|
||||
if i < 0 then invalid_arg "reset: negative index"
|
||||
else (
|
||||
|
|
|
|||
|
|
@ -62,6 +62,10 @@ val get : t -> int -> bool
|
|||
val reset : t -> int -> unit
|
||||
(** Set i-th bit to 0, extending the bitvector if needed. *)
|
||||
|
||||
val set_bool : t -> int -> bool -> unit
|
||||
(** Set or reset [i]-th bit.
|
||||
@since NEXT_RELEASE *)
|
||||
|
||||
val flip : t -> int -> unit
|
||||
(** Flip i-th bit, extending the bitvector if needed. *)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue