8 #ifndef __LIDAR_ENDIAN_H__
9 #define __LIDAR_ENDIAN_H__
13 LT_BEGIN_LIDAR_NAMESPACE
16 #define HOST_IS_BIG_ENDIAN (Endian().isHostBigEndian())
18 #define HOST_IS_LITTLE_ENDIAN (Endian().isHostLittleEndian())
55 template<
size_t size>
static void swap(
void *buffer)
57 unsigned char *head =
static_cast<unsigned char *
>(buffer);
58 unsigned char *tail = head + size - 1;
61 unsigned char temp = *head;
75 static void swap(
void *buffer,
size_t size)
77 unsigned char *head =
static_cast<unsigned char *
>(buffer);
78 unsigned char *tail = head + size - 1;
81 unsigned char temp = *head;
88 const union {
int word;
char byte[
sizeof(int)]; };
92 LT_END_LIDAR_NAMESPACE
Endian is a helper class that figures out the host's byte order.
bool isHostLittleEndian(void) const
Determine if the host is little endian.
bool isHostBigEndian(void) const
Determine if the host is big endian.
static void swap(void *buffer, size_t size)
Swap byte order.
static void swap(void *buffer)
Swap byte order.