Add signed to bitconverter and float

This commit is contained in:
2026-02-15 15:29:28 -06:00
parent 9dae77a0b9
commit 3889c746fe
2 changed files with 108 additions and 26 deletions

View File

@@ -10,42 +10,34 @@ namespace Tesses::Framework::Serialization
*/
class BitConverter {
public:
/**
* @brief Get the bits of a double from a int64_t
*
* @param v a int64_t with double's bits
* @return double the double
*/
static double ToDoubleBits(uint64_t v);
/**
* @brief Get the bits of a int64_t from a double
*
* @param v a double with int64_t's bits
* @return uint64_t the int64_t
*/
static uint64_t ToUintBits(double v);
/**
* @brief Get big endian double from uint8_t reference of first element of 8 byte array
*
* @param b a reference to the first byte of an array
* @return double the double
*/
static float ToFloatBits(uint32_t v);
static uint32_t ToUint32Bits(float v);
static double ToDoubleBE(uint8_t& b);
/**
* @brief Get big endian uint64_t from uint8_t reference of first element of 8 byte array
*
* @param b a reference to the first byte of an array
* @return uint64_t the uint64_t
*/
static float ToFloatBE(uint8_t& b);
static uint64_t ToUint64BE(uint8_t& b);
static uint32_t ToUint32BE(uint8_t& b);
static uint16_t ToUint16BE(uint8_t& b);
static double ToDoubleLE(uint8_t& b);
static float ToFloatLE(uint8_t& b);
static uint64_t ToUint64LE(uint8_t& b);
static uint32_t ToUint32LE(uint8_t& b);
static uint16_t ToUint16LE(uint8_t& b);
static int64_t ToSint64BE(uint8_t& b);
static int32_t ToSint32BE(uint8_t& b);
static int16_t ToSint16BE(uint8_t& b);
static int64_t ToSint64LE(uint8_t& b);
static int32_t ToSint32LE(uint8_t& b);
static int16_t ToSint16LE(uint8_t& b);
static Uuid ToUuid(uint8_t& b);
@@ -53,14 +45,25 @@ class BitConverter {
static void FromDoubleBE(uint8_t& b, double v);
static void FromFloatBE(uint8_t& b, float v);
static void FromUint64BE(uint8_t& b, uint64_t v);
static void FromUint32BE(uint8_t& b, uint32_t v);
static void FromUint16BE(uint8_t& b, uint16_t v);
static void FromDoubleLE(uint8_t& b, double v);
static void FromFloatLE(uint8_t& b, float v);
static void FromUint64LE(uint8_t& b, uint64_t v);
static void FromUint32LE(uint8_t& b, uint32_t v);
static void FromUint16LE(uint8_t& b, uint16_t v);
static void FromSint64BE(uint8_t& b, int64_t v);
static void FromSint32BE(uint8_t& b, int32_t v);
static void FromSint16BE(uint8_t& b, int16_t v);
static void FromSint64LE(uint8_t& b, int64_t v);
static void FromSint32LE(uint8_t& b, int32_t v);
static void FromSint16LE(uint8_t& b, int16_t v);
static void FromUuid(uint8_t& b, const Uuid& uuid);