Utilities. More...
Functions | |
| template<typename T > | |
| void | toNetworkByteOrder (T value, uint8_t *result) |
| Convert an integer-like value to network byte order (i.e. big-endian). | |
| void | toNetworkByteOrder (float value, uint8_t *result) |
| Overload to convert a 32-bit float to network byte order. | |
| void | toNetworkByteOrder (double value, uint8_t *result) |
| Overload to convert a 64-bit double to network byte order. | |
| constexpr uint16_t | read_uint16 (const uint8_t *bytes) |
| Reads a 16-bit unsigned integer from a Big-Endian byte stream. | |
| constexpr uint32_t | read_uint32 (const uint8_t *bytes) |
| Reads a 32-bit unsigned integer from a Big-Endian byte stream. | |
| constexpr uint64_t | read_uint64 (const uint8_t *bytes) |
| Reads a 64-bit unsigned integer from a Big-Endian byte stream. | |
| constexpr int16_t | read_int16 (const uint8_t *bytes) |
| Reads a 16-bit signed integer from a Big-Endian byte stream. | |
| constexpr int32_t | read_int32 (const uint8_t *bytes) |
| Reads a 32-bit signed integer from a Big-Endian byte stream. | |
| constexpr int64_t | read_int64 (const uint8_t *bytes) |
| Reads a 64-bit signed integer from a Big-Endian byte stream. | |
| float | read_float (const uint8_t *bytes) |
| Reads a 32-bit float from a Big-Endian byte stream. | |
| template<typename T = double> | |
| T | read_double (const uint8_t *bytes) |
| Reads a 64-bit double from a Big-Endian byte stream. | |
Utilities.
This namespace contains public utility functions and classes.
|
inline |
Reads a 64-bit double from a Big-Endian byte stream.
|
inline |
Reads a 32-bit float from a Big-Endian byte stream.
|
inlineconstexpr |
Reads a 16-bit signed integer from a Big-Endian byte stream.
|
inlineconstexpr |
Reads a 32-bit signed integer from a Big-Endian byte stream.
|
inlineconstexpr |
Reads a 64-bit signed integer from a Big-Endian byte stream.
|
inlineconstexpr |
Reads a 16-bit unsigned integer from a Big-Endian byte stream.
Basic usage:
Usage with larger buffers:
|
inlineconstexpr |
Reads a 32-bit unsigned integer from a Big-Endian byte stream.
|
inlineconstexpr |
Reads a 64-bit unsigned integer from a Big-Endian byte stream.
|
inline |
Overload to convert a 64-bit double to network byte order.
| value | The double value to convert. | |
| [out] | result | The pointer to the byte buffer where the result will be stored (min 8 bytes). |
|
inline |
Overload to convert a 32-bit float to network byte order.
| value | The float value to convert. | |
| [out] | result | The pointer to the byte buffer where the result will be stored (min 4 bytes). |
|
inline |
Convert an integer-like value to network byte order (i.e. big-endian).
| value | The integer-like value to convert. | |
| [out] | result | The pointer to the byte buffer where the result will be stored. |
The destination buffer must have at least sizeof(T) bytes available.