Bit Reinterpret Helpers
The Bit Reinterpret Helpers allow scripts to inspect the raw bit-pattern of numeric values by converting them into a uint32.
These functions do not convert or scale values — they reinterpret the raw memory bits of the input
uint32 f_to_u32(float f)
uint32 f_to_u32(float f)Returns the raw 32-bit IEEE-754 representation of a float.
uint32 bits = f_to_u32(1.0f); // 0x3F800000uint32 u8_to_u32(uint8 v)
uint32 u8_to_u32(uint8 v)Reinterprets a uint8 as a uint32.
uint32 bits = u8_to_u32(255); // 0x000000FFuint32 u16_to_u32(uint16 v)
uint32 u16_to_u32(uint16 v)Reinterprets the lower 16 bits of a uint16 as a 32-bit integer.
uint32 bits = u16_to_u32(50000);uint32 u64_to_u32(uint64 v)
uint32 u64_to_u32(uint64 v)Returns the lower 32 bits of a 64-bit unsigned integer.
uint32 bits = u64_to_u32(0x1122334455667788);uint32 i8_to_u32(int8 v)
uint32 i8_to_u32(int8 v)Reinterprets a signed 8-bit integer as a 32-bit unsigned integer.
uint32 bits = i8_to_u32(-5); // 0xFFFFFFFBuint32 i16_to_u32(int16 v)
uint32 i16_to_u32(int16 v)Reinterprets a signed 16-bit integer as 32 bits.
uint32 bits = i16_to_u32(-1234);uint32 i32_to_u32(int32 v)
uint32 i32_to_u32(int32 v)Reinterprets a signed 32-bit integer as an unsigned one without numerical conversion.
uint32 bits = i32_to_u32(-1); // 0xFFFFFFFFuint32 i64_to_u32(int64 v)
uint32 i64_to_u32(int64 v)Returns the lower 32 bits of a 64-bit signed integer.
uint32 bits = i64_to_u32(-1); // 0xFFFFFFFFuint32 d_to_u32(double v)
uint32 d_to_u32(double v)Returns the first 4 bytes of a 64-bit double (the lower half of the binary representation).
uint32 bits = d_to_u32(3.1415926535);Last updated