10 #define ENDIANESS __BYTE_ORDER__
13 #define ENDIANESS __ORDER_LITTLE_ENDIAN__
25inline uint16_t
htons(uint16_t v) {
26#if ENDIANESS == __ORDER_LITTLE_ENDIAN__
27 return (v << 8) | (v >> 8);
40inline uint16_t
ntohs(uint16_t v) {
41 #if ENDIANESS == __ORDER_LITTLE_ENDIAN__
42 return (v << 8) | (v >> 8);
55inline uint32_t
htonl(uint32_t v) {
56 #if ENDIANESS == __ORDER_LITTLE_ENDIAN__
57 return ((v & 0xFF000000) >> 24) |
58 ((v & 0x00FF0000) >> 8) |
59 ((v & 0x0000FF00) << 8) |
60 ((v & 0x000000FF) << 24);
73inline uint32_t
ntohl(uint32_t v) {
74 #if ENDIANESS == __ORDER_LITTLE_ENDIAN__
75 return ((v & 0xFF000000) >> 24) |
76 ((v & 0x00FF0000) >> 8) |
77 ((v & 0x0000FF00) << 8) |
78 ((v & 0x000000FF) << 24);
91inline uint64_t
htonl(uint64_t v) {
92 #if ENDIANESS == __ORDER_LITTLE_ENDIAN__
93 return ((v & 0xFF00000000000000ULL) >> 56) |
94 ((v & 0x00FF000000000000ULL) >> 40) |
95 ((v & 0x0000FF0000000000ULL) >> 24) |
96 ((v & 0x000000FF00000000ULL) >> 8) |
97 ((v & 0x00000000FF000000ULL) << 8) |
98 ((v & 0x0000000000FF0000ULL) << 24) |
99 ((v & 0x000000000000FF00ULL) << 40) |
100 ((v & 0x00000000000000FFULL) << 56);
114 #if ENDIANESS == __ORDER_LITTLE_ENDIAN__
115 return ((v & 0xFF00000000000000ULL) >> 56) |
116 ((v & 0x00FF000000000000ULL) >> 40) |
117 ((v & 0x0000FF0000000000ULL) >> 24) |
118 ((v & 0x000000FF00000000ULL) >> 8) |
119 ((v & 0x00000000FF000000ULL) << 8) |
120 ((v & 0x0000000000FF0000ULL) << 24) |
121 ((v & 0x000000000000FF00ULL) << 40) |
122 ((v & 0x00000000000000FFULL) << 56);
155 #if ENDIANESS == __ORDER_LITTLE_ENDIAN__
173 #if ENDIANESS == __ORDER_LITTLE_ENDIAN__
191 #if ENDIANESS == __ORDER_LITTLE_ENDIAN__
209 #if ENDIANESS == __ORDER_LITTLE_ENDIAN__
227 #ifdef FOUND_FLOAT_MODE
242 #ifdef FOUND_FLOAT_MODE
double decimal
Definition decimal.hpp:15
Definition calibrate.cpp:7
decimal htondec(decimal v)
Converts a decimal from host byte order to network byte order.
Definition encoding.hpp:226
uint16_t htons(uint16_t v)
Converts a 16-bit integer from host byte order to network byte order.
Definition encoding.hpp:25
float htonf(float v)
Converts a float from network byte order to host byte order.
Definition encoding.hpp:154
double htond(double v)
Converts a double from host byte order to network byte order.
Definition encoding.hpp:208
uint32_t ntohl(uint32_t v)
Converts a 32-bit integer from network byte order to host byte order.
Definition encoding.hpp:73
float ntohf(float v)
Converts a float from network byte order to host byte order.
Definition encoding.hpp:172
uint32_t calculateCRC32(const void *data, size_t length)
Calculates the CRC32 checksum for a given data buffer.
Definition serialization.cpp:235
uint32_t htonl(uint32_t v)
Converts a 32-bit integer from host byte order to network byte order.
Definition encoding.hpp:55
decimal ntohdec(decimal v)
Converts a decimal from network byte order to host byte order.
Definition encoding.hpp:241
double ntohd(double v)
Converts a double from network byte order to host byte order.
Definition encoding.hpp:190
uint16_t ntohs(uint16_t v)
Converts a 16-bit integer from network byte order to host byte order.
Definition encoding.hpp:40
Union for converting a 64-bit floating point number from host byte order to network byte order and vi...
Definition encoding.hpp:141
uint64_t u
Unsigned 64-bit integer used for encoding or serialization purposes.
Definition encoding.hpp:145
double d
A variable to store a double-precision floating-point value.
Definition encoding.hpp:143
Union for converting a 32-bit floating point number from host byte order to network byte order and vi...
Definition encoding.hpp:131
uint32_t u
Unsigned 32-bit integer used for encoding or serialization purposes.
Definition encoding.hpp:135
float f
Floating-point variable used for storing a single-precision value.
Definition encoding.hpp:133