package smtml
Install
dune-project
Dependency
Authors
-
JJoão Pereira <joaomhmpereira@tecnico.ulisboa.pt>
-
FFilipe Marques <filipe.s.marques@tecnico.ulisboa.pt>
-
HHichem Rami Ait El Hara <hra@ocamlpro.com>
-
Rredianthus <redopam@pm.me>
-
AArthur Carcano <arthur.carcano@ocamlpro.com>
-
PPierre Chambart <pierre.chambart@ocamlpro.com>
-
JJosé Fragoso Santos <jose.fragoso@tecnico.ulisboa.pt>
Maintainers
Sources
md5=2ec822c82786736b275c31e850f7d292
sha512=335a1595b0652ca0d5aa50177e47a66467935d586433ad26329d6fa7d9ff6fd3eda51d630c2002278eb6565e8de83e0750b000c0a0f5b453b7ed11ffca3519a2
doc/smtml/Smtml/Typed/Bitv32/index.html
Module Typed.Bitv32Source
include Bitv.S with type w = bitv32
to_int ~signed t converts the bitvector t to an integer term. If signed is true, t is treated as a 2's complement signed value.
rotate_left t amount rotates the bits of t to the left by amount.
rotate_right t amount rotates the bits of t to the right by amount.
concat t1 t2 concatenates t1 (high bits) and t2 (low bits).
Example: concat (v8 0xAA) (v8 0xBB) results in 0xAABB (16-bit).
extract t ~high ~low extracts the bytes from index high down to low (inclusive).
Example: extract (i32 0xAABBCCDD) ~high:2 ~low:1 results in 0xCC (1-byte).
zero_extend n t extends t to a width of width(t) + n by padding with zeros.
sign_extend n t extends t to a width of width(t) + n by replicating the sign bit.
of_int32 i creates a 32-bit vector from an OCaml Int32.t.
to_bytes t splits the 32-bit vector into 4 bytes (little-endian).
Truncate float to signed integer (raises exception on overflow/NaN).
trunc_f32_s_exn f truncates a float32 to a signed integer. Raises Eval.Eval_error exception on failure.
trunc_f32_u_exn f truncates a float32 to an unsigned integer. Raises Eval.Eval_error exception on failure.
trunc_f64_s_exn f truncates a float64 to a signed integer. Raises Eval.Eval_error exception on failure.
trunc_f64_u_exn f truncates a float64 to an unsigned integer. Raises Eval.Eval_error exception on failure.
Truncate float to signed integer (returns result/error).
val trunc_f32_s :
float32 expr ->
(t, [> `Integer_overflow | `Conversion_to_integer ]) Smtml_prelude.resulttrunc_f32_s f attempts to truncate a float32 to a signed integer.
val trunc_f32_u :
float32 expr ->
(t, [> `Integer_overflow | `Conversion_to_integer ]) Smtml_prelude.resulttrunc_f32_u f attempts to truncate a float32 to an unsigned integer.
val trunc_f64_s :
float64 expr ->
(t, [> `Integer_overflow | `Conversion_to_integer ]) Smtml_prelude.resulttrunc_f64_s f attempts to truncate a float64 to a signed integer.
val trunc_f64_u :
float64 expr ->
(t, [> `Integer_overflow | `Conversion_to_integer ]) Smtml_prelude.resulttrunc_f64_u f attempts to truncate a float64 to an unsigned integer.
Truncate with saturation (clamps to min/max on overflow, 0 on NaN).
trunc_sat_f32_s f truncates a float32 to signed integer with saturation. (Clamps to min/max on overflow, 0 on NaN).
trunc_sat_f32_u f truncates a float32 to unsigned integer with saturation. (Clamps to min/max on overflow, 0 on NaN).
trunc_sat_f64_s f truncates a float64 to signed integer with saturation. (Clamps to min/max on overflow, 0 on NaN).
trunc_sat_f64_u f truncates a float64 to unsigned integer with saturation. (Clamps to min/max on overflow, 0 on NaN).
reinterpret_f32 t interprets the bits of a float32 as a bitv32.