wasmer_compiler/
constants.rs

1// Constants for the bounds of truncation operations. These are the least or
2// greatest exact floats in either f32 or f64 representation
3// greater-than-or-equal-to (for least) or less-than-or-equal-to (for greatest)
4// the i32 or i64 or u32 or u64 min (for least) or max (for greatest), when
5// rounding towards zero.
6
7/// Least Exact Float (32 bits) greater-than-or-equal-to i32::MIN when rounding towards zero.
8pub const LEF32_GEQ_I32_MIN: u64 = i32::MIN as u64;
9/// Greatest Exact Float (32 bits) less-than-or-equal-to i32::MAX when rounding towards zero.
10pub const GEF32_LEQ_I32_MAX: u64 = 2147483520; // bits as f32: 0x4eff_ffff
11/// Least Exact Float (64 bits) greater-than-or-equal-to i32::MIN when rounding towards zero.
12pub const LEF64_GEQ_I32_MIN: u64 = i32::MIN as u64;
13/// Greatest Exact Float (64 bits) less-than-or-equal-to i32::MAX when rounding towards zero.
14pub const GEF64_LEQ_I32_MAX: u64 = i32::MAX as u64;
15/// Least Exact Float (32 bits) greater-than-or-equal-to u32::MIN when rounding towards zero.
16pub const LEF32_GEQ_U32_MIN: u64 = u32::MIN as u64;
17/// Greatest Exact Float (32 bits) less-than-or-equal-to u32::MAX when rounding towards zero.
18pub const GEF32_LEQ_U32_MAX: u64 = 4294967040; // bits as f32: 0x4f7f_ffff
19/// Least Exact Float (64 bits) greater-than-or-equal-to u32::MIN when rounding towards zero.
20pub const LEF64_GEQ_U32_MIN: u64 = u32::MIN as u64;
21/// Greatest Exact Float (64 bits) less-than-or-equal-to u32::MAX when rounding towards zero.
22pub const GEF64_LEQ_U32_MAX: u64 = 4294967295; // bits as f64: 0x41ef_ffff_ffff_ffff
23/// Least Exact Float (32 bits) greater-than-or-equal-to i64::MIN when rounding towards zero.
24pub const LEF32_GEQ_I64_MIN: u64 = i64::MIN as u64;
25/// Greatest Exact Float (32 bits) less-than-or-equal-to i64::MAX when rounding towards zero.
26pub const GEF32_LEQ_I64_MAX: u64 = 9223371487098961920; // bits as f32: 0x5eff_ffff
27/// Least Exact Float (64 bits) greater-than-or-equal-to i64::MIN when rounding towards zero.
28pub const LEF64_GEQ_I64_MIN: u64 = i64::MIN as u64;
29/// Greatest Exact Float (64 bits) less-than-or-equal-to i64::MAX when rounding towards zero.
30pub const GEF64_LEQ_I64_MAX: u64 = 9223372036854774784; // bits as f64: 0x43df_ffff_ffff_ffff
31/// Least Exact Float (32 bits) greater-than-or-equal-to u64::MIN when rounding towards zero.
32pub const LEF32_GEQ_U64_MIN: u64 = u64::MIN;
33/// Greatest Exact Float (32 bits) less-than-or-equal-to u64::MAX when rounding towards zero.
34pub const GEF32_LEQ_U64_MAX: u64 = 18446742974197923840; // bits as f32: 0x5f7f_ffff
35/// Least Exact Float (64 bits) greater-than-or-equal-to u64::MIN when rounding towards zero.
36pub const LEF64_GEQ_U64_MIN: u64 = u64::MIN;
37/// Greatest Exact Float (64 bits) less-than-or-equal-to u64::MAX when rounding towards zero.
38pub const GEF64_LEQ_U64_MAX: u64 = 18446744073709549568; // bits as f64: 0x43ef_ffff_ffff_ffff
39
40/// Canonical NaN value for f32 type
41pub const CANONICAL_NAN_F32: u32 = 0x7fc00000;
42/// Canonical NaN value for f64 type
43pub const CANONICAL_NAN_F64: u64 = 0x7ff8000000000000;