diff options
author | Son Ho | 2023-12-13 16:54:10 +0100 |
---|---|---|
committer | Son Ho | 2023-12-13 16:54:10 +0100 |
commit | c48859717d847f4492a0c3cc76e8f8b0b38fcc10 (patch) | |
tree | 15e16de213825acbb403c8a6d16f0f2e5c0d4618 /backends/fstar | |
parent | c6247e0c103cc1dc95c2a63ae01602c4a1208dc4 (diff) |
Update the extraction to handle casts between integers/bools
Diffstat (limited to '')
-rw-r--r-- | backends/fstar/Primitives.fst | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/backends/fstar/Primitives.fst b/backends/fstar/Primitives.fst index dd340c00..a3ffbde4 100644 --- a/backends/fstar/Primitives.fst +++ b/backends/fstar/Primitives.fst @@ -273,6 +273,10 @@ let scalar_shr (#ty0 #ty1 : scalar_ty) let scalar_cast (src_ty : scalar_ty) (tgt_ty : scalar_ty) (x : scalar src_ty) : result (scalar tgt_ty) = mk_scalar tgt_ty x +// This can't fail, but for now we make all casts faillible (easier for the translation) +let scalar_cast_bool (tgt_ty : scalar_ty) (x : bool) : result (scalar tgt_ty) = + mk_scalar tgt_ty (if x then 1 else 0) + /// The scalar types type isize : eqtype = scalar Isize type i8 : eqtype = scalar I8 |