12 #ifndef __LIDAR_ENDIAN_H__ 13 #define __LIDAR_ENDIAN_H__ 17 LT_BEGIN_LIDAR_NAMESPACE
20 #define HOST_IS_BIG_ENDIAN (Endian().isHostBigEndian()) 22 #define HOST_IS_LITTLE_ENDIAN (Endian().isHostLittleEndian()) 59 template<
size_t size>
static void swap(
void *buffer)
61 unsigned char *head =
static_cast<unsigned char *
>(buffer);
62 unsigned char *tail = head + size - 1;
65 unsigned char temp = *head;
79 static void swap(
void *buffer,
size_t size)
81 unsigned char *head =
static_cast<unsigned char *
>(buffer);
82 unsigned char *tail = head + size - 1;
85 unsigned char temp = *head;
92 const union {
int word;
char byte[
sizeof(int)]; };
96 LT_END_LIDAR_NAMESPACE
97 #endif // __LIDAR_ENDIAN_H__ bool isHostLittleEndian(void) const
Determine if the host is little endian.
static void swap(void *buffer)
Swap byte order.
Endian is a helper class that figures out the host's byte order.
bool isHostBigEndian(void) const
Determine if the host is big endian.
static void swap(void *buffer, size_t size)
Swap byte order.