Skip to content

Commit

Permalink
Fixes redundant os constraints and add more CI
Browse files Browse the repository at this point in the history
  • Loading branch information
filipeom committed Apr 18, 2024
1 parent ebe45e9 commit 81c7bfe
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 13 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ jobs:
- "4.14"
- "5.1"
runs-on: ${{ matrix.os }}
env:
OPAMCONFIRMLEVEL: unsafe-yes # allow opam depext to yes package manager prompts
steps:
- name: Checkout
uses: actions/checkout@v4
Expand Down
5 changes: 0 additions & 5 deletions encoding.opam.template

This file was deleted.

28 changes: 20 additions & 8 deletions lib/eval.ml
Original file line number Diff line number Diff line change
Expand Up @@ -304,15 +304,21 @@ module I32 = struct
Int32.logor (shr_u x (Int32.of_int n)) (shl x (Int32.of_int (32 - n)))
[@@inline]

let clz n =
let n = Ocaml_intrinsics.Int32.count_leading_zeros n in
Int32.of_int n

let ctz n =
let n = Ocaml_intrinsics.Int32.count_trailing_zeros n in
Int32.of_int n

let unop (op : unop) (v : Value.t) : Value.t =
let f =
match op with
| Neg -> Int32.neg
| Not -> Int32.lognot
| Clz ->
fun n -> Int32.of_int (Ocaml_intrinsics.Int32.count_leading_zeros n)
| Ctz ->
fun n -> Int32.of_int (Ocaml_intrinsics.Int32.count_trailing_zeros n)
| Clz -> clz
| Ctz -> ctz
| _ -> Log.err {|unop: Unsupported i32 operator "%a"|} Ty.pp_unop op
in
to_value (f (of_value 1 v))
Expand Down Expand Up @@ -397,15 +403,21 @@ module I64 = struct
Int64.logor (shr_u x (Int64.of_int n)) (shl x (Int64.of_int (64 - n)))
[@@inline]

let clz n =
let n = Ocaml_intrinsics.Int64.count_leading_zeros n in
Int64.of_int n

let ctz n =
let n = Ocaml_intrinsics.Int64.count_trailing_zeros n in
Int64.of_int n

let unop (op : unop) (v : Value.t) : Value.t =
let f =
match op with
| Neg -> Int64.neg
| Not -> Int64.lognot
| Clz ->
fun n -> Int64.of_int (Ocaml_intrinsics.Int64.count_leading_zeros n)
| Ctz ->
fun n -> Int64.of_int (Ocaml_intrinsics.Int64.count_trailing_zeros n)
| Clz -> clz
| Ctz -> ctz
| _ -> Log.err {|unop: Unsupported i64 operator "%a"|} Ty.pp_unop op
in
to_value (f (of_value 1 v))
Expand Down
5 changes: 5 additions & 0 deletions smtml.opam
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,8 @@ build: [
]
]
dev-repo: "git+https://github.com/formalsec/smtml.git"
available: arch != "arm32" & arch != "x86_32"
pin-depends: [
["colibri2.0.4.0" "git+https://git.frama-c.com/pub/colibrics.git#ae18d699b19e7967a81ccae6db454edfa968feae"]
["colibrilib.0.4.0" "git+https://git.frama-c.com/pub/colibrics.git#ae18d699b19e7967a81ccae6db454edfa968feae"]
]
5 changes: 5 additions & 0 deletions smtml.opam.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
available: arch != "arm32" & arch != "x86_32"
pin-depends: [
["colibri2.0.4.0" "git+https://git.frama-c.com/pub/colibrics.git#ae18d699b19e7967a81ccae6db454edfa968feae"]
["colibrilib.0.4.0" "git+https://git.frama-c.com/pub/colibrics.git#ae18d699b19e7967a81ccae6db454edfa968feae"]
]

0 comments on commit 81c7bfe

Please sign in to comment.