Go to the documentation of this file.
20 #include <sys/types.h>
23 #define inline __inline
24 #define uint64_t unsigned __int64
25 #define uint32_t unsigned __int32
34 #include <netinet/in.h>
41 #define lo_swap16(x) htons(x)
43 #define lo_swap32(x) htonl(x)
48 #define lo_swap16(x) \
52 (((uint16_t)(__x) & (uint16_t)0x00ffU) << 8) | \
53 (((uint16_t)(__x) & (uint16_t)0xff00U) >> 8) )); \
55 #warning USING UNOPTIMISED ENDIAN STUFF
59 #define lo_swap32(x) \
63 (((uint32_t)(__x) & (uint32_t)0x000000ffUL) << 24) | \
64 (((uint32_t)(__x) & (uint32_t)0x0000ff00UL) << 8) | \
65 (((uint32_t)(__x) & (uint32_t)0x00ff0000UL) >> 8) | \
66 (((uint32_t)(__x) & (uint32_t)0xff000000UL) >> 24) )); \
72 #define lo_swap64(x) \
76 (uint64_t)(((uint64_t)(__x) & (uint64_t)0x00000000000000ffULL) << 56) | \
77 (uint64_t)(((uint64_t)(__x) & (uint64_t)0x000000000000ff00ULL) << 40) | \
78 (uint64_t)(((uint64_t)(__x) & (uint64_t)0x0000000000ff0000ULL) << 24) | \
79 (uint64_t)(((uint64_t)(__x) & (uint64_t)0x00000000ff000000ULL) << 8) | \
80 (uint64_t)(((uint64_t)(__x) & (uint64_t)0x000000ff00000000ULL) >> 8) | \
81 (uint64_t)(((uint64_t)(__x) & (uint64_t)0x0000ff0000000000ULL) >> 24) | \
82 (uint64_t)(((uint64_t)(__x) & (uint64_t)0x00ff000000000000ULL) >> 40) | \
83 (uint64_t)(((uint64_t)(__x) & (uint64_t)0xff00000000000000ULL) >> 56) )); \
111 #define lo_htoo16(x) (x)
112 #define lo_htoo32(x) (x)
113 #define lo_htoo64(x) (x)
114 #define lo_otoh16(x) (x)
115 #define lo_otoh32(x) (x)
116 #define lo_otoh64(x) (x)
118 #define lo_htoo16 lo_swap16
119 #define lo_htoo32 lo_swap32
120 #define lo_htoo64 lo_swap64
121 #define lo_otoh16 lo_swap16
122 #define lo_otoh32 lo_swap32
123 #define lo_otoh64 lo_swap64