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
convert_u16_to_f16(value: int) -> float
¶
Convert an IEEE 754 float to a raw unsigned integer representation.
Source code in xdsl/utils/bitwise_casts.py
convert_f32_to_u32(value: float) -> int
¶
Convert an IEEE 754 float to a raw unsigned integer representation.
convert_u32_to_f32(value: int) -> float
¶
Convert a raw 32-bit unsigned integer to IEEE 754 float representation.
convert_f64_to_u64(value: float) -> int
¶
Convert an IEEE 754 float to a raw unsigned integer representation.
convert_u64_to_f64(value: int) -> float
¶
Convert a raw 32-bit unsigned integer to IEEE 754 float representation.
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