Bitwise casts
bitwise_casts
A collection of helpers for reinterpreting bits. Used in lowering and interpreting low-level dialects.
convert_f16_to_u16(value: float) -> int
Convert an IEEE 754 float to a raw unsigned integer representation.
Source code in xdsl/utils/bitwise_casts.py
10 11 12 13 14 15 | |
convert_u16_to_f16(value: int) -> int
Convert an IEEE 754 float to a raw unsigned integer representation.
Source code in xdsl/utils/bitwise_casts.py
18 19 20 21 22 23 | |
convert_f32_to_u32(value: float) -> int
Convert an IEEE 754 float to a raw unsigned integer representation.
Source code in xdsl/utils/bitwise_casts.py
26 27 28 29 30 31 32 | |
convert_u32_to_f32(value: int) -> float
Convert a raw 32-bit unsigned integer to IEEE 754 float representation.
Source code in xdsl/utils/bitwise_casts.py
35 36 37 38 39 40 41 | |
convert_f64_to_u64(value: float) -> int
Convert an IEEE 754 float to a raw unsigned integer representation.
Source code in xdsl/utils/bitwise_casts.py
44 45 46 47 48 49 50 | |
convert_u64_to_f64(value: int) -> float
Convert a raw 32-bit unsigned integer to IEEE 754 float representation.
Source code in xdsl/utils/bitwise_casts.py
53 54 55 56 57 58 59 | |
is_power_of_two(value: int) -> bool
Return True if an integer is a power of two. Powers of two have only one bit set to one
Source code in xdsl/utils/bitwise_casts.py
62 63 64 65 66 67 | |