diff options
Diffstat (limited to 'lib/ocaml_rts/linksem/src_lem_library/bit.ml')
| -rw-r--r-- | lib/ocaml_rts/linksem/src_lem_library/bit.ml | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/ocaml_rts/linksem/src_lem_library/bit.ml b/lib/ocaml_rts/linksem/src_lem_library/bit.ml new file mode 100644 index 00000000..bd972008 --- /dev/null +++ b/lib/ocaml_rts/linksem/src_lem_library/bit.ml @@ -0,0 +1,19 @@ +type bit = Zero | One + +let to_bool b = match b with | Zero -> false | _ -> true +let bn b = match b with | Zero -> One | One -> Zero +let bor b1 b2 = match (b1,b2) with + | Zero,Zero -> Zero + | _ -> One +let xor b1 b2 = match (b1,b2) with + | Zero,Zero -> Zero + | Zero,One | One,Zero -> One + | _ -> Zero +let band b1 b2 = match (b1,b2) with + | One,One -> One + | _ -> Zero + +let add b1 b2 = match (b1,b2) with + | Zero,Zero -> Zero, false + | Zero,One | One,Zero -> One, false + | One,One -> Zero, true |
