diff options
author | Son Ho | 2023-12-14 17:11:54 +0100 |
---|---|---|
committer | Son Ho | 2023-12-14 17:11:54 +0100 |
commit | f074320eee2203857e669cfb72f7f8f94ab52151 (patch) | |
tree | d5f2f8d4a45f206e0a94e980ea4c6ad074f2bc19 /backends/coq | |
parent | f69ac6a4a244c99a41a90ed57f74ea83b3835882 (diff) | |
parent | c3e0b90e422cbd902ee6d2b47073940c0017b7fb (diff) |
Merge remote-tracking branch 'origin/main' into son/merge_back
Diffstat (limited to 'backends/coq')
-rw-r--r-- | backends/coq/Primitives.v | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/backends/coq/Primitives.v b/backends/coq/Primitives.v index 99ffe070..84280b96 100644 --- a/backends/coq/Primitives.v +++ b/backends/coq/Primitives.v @@ -266,6 +266,10 @@ Axiom scalar_shr : forall ty0 ty1, scalar ty0 -> scalar ty1 -> result (scalar ty Definition scalar_cast (src_ty tgt_ty : scalar_ty) (x : scalar src_ty) : result (scalar tgt_ty) := mk_scalar tgt_ty (to_Z x). +(* This can't fail, but for now we make all casts faillible (easier for the translation) *) +Definition scalar_cast_bool (tgt_ty : scalar_ty) (x : bool) : result (scalar tgt_ty) := + mk_scalar tgt_ty (if x then 1 else 0). + (** Comparisons *) Definition scalar_leb {ty : scalar_ty} (x : scalar ty) (y : scalar ty) : bool := Z.leb (to_Z x) (to_Z y) . |