Skip to content

Commit

Permalink
fix(Bitv): fix the is_subset function
Browse files Browse the repository at this point in the history
in a bit vector, given two set i and b, testing "(i && b) <> 0" is
testing if the intersection is non-empty and not if i is a subset of b.
  • Loading branch information
FardaleM committed Dec 4, 2023
1 parent 45aa4f0 commit 6ffb0bc
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/unification/Bitv.ml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ module Int : S with type t = private int = struct

let is_empty n = (n = 0)
let is_singleton n = n land (n-1) = 0
let is_subset i b = (i && b) <> 0
let is_subset i b = (i && b) = i
let mem i b = is_subset (singleton i) b

let pp = CCInt.pp_binary
Expand All @@ -57,7 +57,7 @@ module Z : S with type t = private Z.t = struct

let is_empty n = Z.(n = zero)
let is_singleton n = Z.(n land (n-one) = zero)
let is_subset i b = Z.((i && b) <> zero)
let is_subset i b = (i && b) = i
let mem i b = is_subset (singleton i) b

let pp = Z.pp_print
Expand Down

0 comments on commit 6ffb0bc

Please sign in to comment.