Endian is a helper class that figures out the host's byte order.
More...
#include <Endian.h>
|
template<size_t size> |
static void | swap (void *buffer) |
| Swap byte order. More...
|
|
static void | swap (void *buffer, size_t size) |
| Swap byte order. More...
|
|
|
union { |
int word |
|
char byte [sizeof(int)] |
|
}; | |
|
The Endian class is used to figure out if the host is big or little endian and swap between byte orders.
Definition at line 30 of file Endian.h.
bool Endian::isHostBigEndian |
( |
void |
| ) |
const |
|
inline |
This method returns true when the host is big endian. The compiler should be able the optimize this function call away.
Definition at line 41 of file Endian.h.
References byte.
bool Endian::isHostLittleEndian |
( |
void |
| ) |
const |
|
inline |
This method returns true when the host is little endian. The compiler should be able the optimize this function call away.
Definition at line 48 of file Endian.h.
References byte.
template<size_t size>
static void Endian::swap |
( |
void * |
buffer | ) |
|
|
inlinestatic |
This method swaps the byte order of the buffer.
- Parameters
-
size | the length of the buffer (in most cases it is a power of 2) |
buffer | the data to be swapped |
Definition at line 59 of file Endian.h.
static void Endian::swap |
( |
void * |
buffer, |
|
|
size_t |
size |
|
) |
| |
|
inlinestatic |
This method swaps the byte order of the buffer.
- Parameters
-
buffer | the data to be swapped |
size | the length of the buffer (in most cases it is a power of 2) |
Definition at line 79 of file Endian.h.
char Endian::byte[sizeof(int)] |
The documentation for this class was generated from the following file: