Byte-order conversion routines.
More...
#include <ByteOrder.h++>
|
| static uint16_t | hostToNetwork (uint16_t n) |
| | Convert an unsigned 16-bit integer from host to network byte-order. More...
|
| |
| static uint32_t | hostToNetwork (uint32_t n) |
| | Convert an unsigned 32-bit integer from host to network byte-order. More...
|
| |
| static uint64_t | hostToNetwork (uint64_t n) |
| | Convert an unsigned 64-bit integer from host to network byte-order. More...
|
| |
| static uint16_t | networkToHost (uint16_t n) |
| | Convert an unsigned 16-bit integer from network to host byte-order. More...
|
| |
| static uint32_t | networkToHost (uint32_t n) |
| | Convert an unsigned 32-bit integer from network to host byte-order. More...
|
| |
| static uint64_t | networkToHost (uint64_t n) |
| | Convert an unsigned 64-bit integer from network to host byte-order. More...
|
| |
| static bool | isBigEndian () |
| | Determine if the host system is big-endian. More...
|
| |
| static bool | isLittleEndian () |
| | Determine if the host system is little-endian. More...
|
| |
| static Endianness | getEndianness () |
| | Get the endianness of the host system. More...
|
| |
| template<typename T > |
| static T & | reverseBytes (T &value) |
| | Reverse the bytes in a value. More...
|
| |
Byte-order conversion routines.
- Author
- Mark Lindner
◆ getEndianness()
Get the endianness of the host system.
- Returns
- The endianness.
◆ hostToNetwork() [1/3]
| static uint16_t hostToNetwork |
( |
uint16_t |
n | ) |
|
|
inlinestatic |
Convert an unsigned 16-bit integer from host to network byte-order.
◆ hostToNetwork() [2/3]
| static uint32_t hostToNetwork |
( |
uint32_t |
n | ) |
|
|
inlinestatic |
Convert an unsigned 32-bit integer from host to network byte-order.
◆ hostToNetwork() [3/3]
| uint64_t hostToNetwork |
( |
uint64_t |
n | ) |
|
|
static |
Convert an unsigned 64-bit integer from host to network byte-order.
◆ isBigEndian()
Determine if the host system is big-endian.
- Returns
- true if the host system is big-endian, false otherwise.
◆ isLittleEndian()
| static bool isLittleEndian |
( |
| ) |
|
|
inlinestatic |
Determine if the host system is little-endian.
- Returns
- true if the host system is little-endian, false otherwise.
◆ networkToHost() [1/3]
| static uint16_t networkToHost |
( |
uint16_t |
n | ) |
|
|
inlinestatic |
Convert an unsigned 16-bit integer from network to host byte-order.
◆ networkToHost() [2/3]
| static uint32_t networkToHost |
( |
uint32_t |
n | ) |
|
|
inlinestatic |
Convert an unsigned 32-bit integer from network to host byte-order.
◆ networkToHost() [3/3]
| uint64_t networkToHost |
( |
uint64_t |
n | ) |
|
|
static |
Convert an unsigned 64-bit integer from network to host byte-order.
◆ reverseBytes()
| static T& reverseBytes |
( |
T & |
value | ) |
|
|
inlinestatic |
Reverse the bytes in a value.
This method may be used to toggle the endianness of an arbitrary value.
- Parameters
-
- Returns
- The value.
The documentation for this class was generated from the following files: