Skip to content

Commit

Permalink
remove boolify which leads to wrong results in some cases
Browse files Browse the repository at this point in the history
  • Loading branch information
zapashcanon committed Sep 10, 2023
1 parent 67440af commit 35c3527
Showing 1 changed file with 3 additions and 15 deletions.
18 changes: 3 additions & 15 deletions src/sym_value.ml
Original file line number Diff line number Diff line change
Expand Up @@ -162,21 +162,9 @@ module S = struct

let unsigned_rem e1 e2 = binop (I32 RemU) e1 e2

let boolify e =
match e with
| Val (Num (I32 i)) -> Some (Val (Bool (Int32.ne i 0l)))
| Cvtop (I32 OfBool, cond) -> Some cond
| _ -> None

let logand e1 e2 =
match (boolify e1, boolify e2) with
| Some b1, Some b2 -> Bool.int32 (Bool.and_ b1 b2)
| _ -> binop (I32 And) e1 e2

let logor e1 e2 =
match (boolify e1, boolify e2) with
| Some b1, Some b2 -> Bool.int32 (Bool.or_ b1 b2)
| _ -> binop (I32 Or) e1 e2
let logand e1 e2 = binop (I32 And) e1 e2

let logor e1 e2 = binop (I32 Or) e1 e2

let logxor e1 e2 = binop (I32 Xor) e1 e2

Expand Down

0 comments on commit 35c3527

Please sign in to comment.