mirror of
https://github.com/c-cube/ocaml-containers.git
synced 2025-12-06 11:15:31 -05:00
fix(BV): equal function
This commit is contained in:
parent
cc55e4cdfb
commit
090945c3f8
1 changed files with 10 additions and 1 deletions
|
|
@ -196,7 +196,16 @@ let flip bv i =
|
|||
)
|
||||
|
||||
let clear bv = Bytes.fill bv.b 0 (Bytes.length bv.b) zero
|
||||
let equal x y : bool = x.size = y.size && x.b = y.b
|
||||
|
||||
let equal_bytes_ size b1 b2 =
|
||||
try
|
||||
for i = 0 to bytes_length_of_size size - 1 do
|
||||
if Bytes.get b1 i <> Bytes.get b2 i then raise_notrace Exit
|
||||
done;
|
||||
true
|
||||
with Exit -> false
|
||||
|
||||
let equal x y : bool = x.size = y.size && equal_bytes_ x.size x.b y.b
|
||||
|
||||
let iter bv f =
|
||||
let len = bytes_length_of_size bv.size in
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue