25 #ifndef SER4CPP_FLOAT_BYTE_ORDER_H 26 #define SER4CPP_FLOAT_BYTE_ORDER_H 28 #include "ser4cpp/util/Uncopyable.h" 38 enum class Value : uint8_t
47 static Value order = get_byte_order();
58 static Value get_byte_order()
60 if (is_normal_byte_order())
62 return FloatByteOrder::Value::normal;
64 else if (is_reverse_byte_order())
66 return FloatByteOrder::Value::reverse;
70 return FloatByteOrder::Value::unsupported;
74 static bool is_normal_byte_order()
76 FloatUnion value = {{ 0x00, 0x00, 0xA0, 0xC1 }};
77 return (value.f == -20.0f);
80 static bool is_reverse_byte_order()
82 FloatUnion value = {{ 0xC1, 0xA0, 0x00, 0x00 }};
83 return (value.f == -20.0f);
ser4cpp header-only library namespace