NinjaFlight
|
#include <stdint.h>
Go to the source code of this file.
Functions | |
uint32_t | castFloatBytesToInt (float f) |
uint32_t | zigzagEncode (int32_t value) |
uint32_t castFloatBytesToInt | ( | float | f | ) |
Cast the in-memory representation of the given float directly to an int.
This is useful for printing the hex representation of a float number (which is considerably cheaper than a full decimal float formatter, in both code size and output length).
uint32_t zigzagEncode | ( | int32_t | value | ) |
ZigZag encoding maps all values of a signed integer into those of an unsigned integer in such a way that numbers of small absolute value correspond to small integers in the result.
(Compared to just casting a signed to an unsigned which creates huge resulting numbers for small negative integers).