4 * Cast the in-memory representation of the given float directly to an int.
6 * This is useful for printing the hex representation of a float number (which is considerably cheaper
7 * than a full decimal float formatter, in both code size and output length).
9 uint32_t castFloatBytesToInt(float f
)
11 union floatConvert_t
{
18 return floatConvert
.u
;
22 * ZigZag encoding maps all values of a signed integer into those of an unsigned integer in such
23 * a way that numbers of small absolute value correspond to small integers in the result.
25 * (Compared to just casting a signed to an unsigned which creates huge resulting numbers for
26 * small negative integers).
28 uint32_t zigzagEncode(int32_t value
)
30 return (uint32_t)((value
<< 1) ^ (value
>> 31));