6 #ifndef RAVEN_COMPAT_ENDIAN_H 7 #define RAVEN_COMPAT_ENDIAN_H 9 #if defined(HAVE_CONFIG_H) 17 #if defined(HAVE_ENDIAN_H) 19 #elif defined(HAVE_SYS_ENDIAN_H) 20 #include <sys/endian.h> 23 #if defined(WORDS_BIGENDIAN) 25 #if HAVE_DECL_HTOBE16 == 0 26 inline uint16_t
htobe16(uint16_t host_16bits)
30 #endif // HAVE_DECL_HTOBE16 32 #if HAVE_DECL_HTOLE16 == 0 33 inline uint16_t
htole16(uint16_t host_16bits)
37 #endif // HAVE_DECL_HTOLE16 39 #if HAVE_DECL_BE16TOH == 0 40 inline uint16_t
be16toh(uint16_t big_endian_16bits)
42 return big_endian_16bits;
44 #endif // HAVE_DECL_BE16TOH 46 #if HAVE_DECL_LE16TOH == 0 47 inline uint16_t
le16toh(uint16_t little_endian_16bits)
49 return bswap_16(little_endian_16bits);
51 #endif // HAVE_DECL_LE16TOH 53 #if HAVE_DECL_HTOBE32 == 0 54 inline uint32_t
htobe32(uint32_t host_32bits)
58 #endif // HAVE_DECL_HTOBE32 60 #if HAVE_DECL_HTOLE32 == 0 61 inline uint32_t
htole32(uint32_t host_32bits)
65 #endif // HAVE_DECL_HTOLE32 67 #if HAVE_DECL_BE32TOH == 0 68 inline uint32_t
be32toh(uint32_t big_endian_32bits)
70 return big_endian_32bits;
72 #endif // HAVE_DECL_BE32TOH 74 #if HAVE_DECL_LE32TOH == 0 75 inline uint32_t
le32toh(uint32_t little_endian_32bits)
77 return bswap_32(little_endian_32bits);
79 #endif // HAVE_DECL_LE32TOH 81 #if HAVE_DECL_HTOBE64 == 0 82 inline uint64_t
htobe64(uint64_t host_64bits)
86 #endif // HAVE_DECL_HTOBE64 88 #if HAVE_DECL_HTOLE64 == 0 89 inline uint64_t
htole64(uint64_t host_64bits)
93 #endif // HAVE_DECL_HTOLE64 95 #if HAVE_DECL_BE64TOH == 0 96 inline uint64_t
be64toh(uint64_t big_endian_64bits)
98 return big_endian_64bits;
100 #endif // HAVE_DECL_BE64TOH 102 #if HAVE_DECL_LE64TOH == 0 103 inline uint64_t
le64toh(uint64_t little_endian_64bits)
105 return bswap_64(little_endian_64bits);
107 #endif // HAVE_DECL_LE64TOH 109 #else // WORDS_BIGENDIAN 111 #if HAVE_DECL_HTOBE16 == 0 116 #endif // HAVE_DECL_HTOBE16 118 #if HAVE_DECL_HTOLE16 == 0 123 #endif // HAVE_DECL_HTOLE16 125 #if HAVE_DECL_BE16TOH == 0 126 inline uint16_t
be16toh(uint16_t big_endian_16bits)
130 #endif // HAVE_DECL_BE16TOH 132 #if HAVE_DECL_LE16TOH == 0 133 inline uint16_t
le16toh(uint16_t little_endian_16bits)
135 return little_endian_16bits;
137 #endif // HAVE_DECL_LE16TOH 139 #if HAVE_DECL_HTOBE32 == 0 144 #endif // HAVE_DECL_HTOBE32 146 #if HAVE_DECL_HTOLE32 == 0 151 #endif // HAVE_DECL_HTOLE32 153 #if HAVE_DECL_BE32TOH == 0 154 inline uint32_t
be32toh(uint32_t big_endian_32bits)
158 #endif // HAVE_DECL_BE32TOH 160 #if HAVE_DECL_LE32TOH == 0 161 inline uint32_t
le32toh(uint32_t little_endian_32bits)
163 return little_endian_32bits;
165 #endif // HAVE_DECL_LE32TOH 167 #if HAVE_DECL_HTOBE64 == 0 172 #endif // HAVE_DECL_HTOBE64 174 #if HAVE_DECL_HTOLE64 == 0 179 #endif // HAVE_DECL_HTOLE64 181 #if HAVE_DECL_BE64TOH == 0 182 inline uint64_t
be64toh(uint64_t big_endian_64bits)
186 #endif // HAVE_DECL_BE64TOH 188 #if HAVE_DECL_LE64TOH == 0 189 inline uint64_t
le64toh(uint64_t little_endian_64bits)
191 return little_endian_64bits;
193 #endif // HAVE_DECL_LE64TOH 195 #endif // WORDS_BIGENDIAN 197 #endif // RAVEN_COMPAT_ENDIAN_H uint64_t htobe64(uint64_t host_64bits)
uint32_t be32toh(uint32_t big_endian_32bits)
uint32_t htole32(uint32_t host_32bits)
uint32_t bswap_32(uint32_t x)
uint32_t htobe32(uint32_t host_32bits)
uint64_t be64toh(uint64_t big_endian_64bits)
uint16_t htobe16(uint16_t host_16bits)
uint16_t bswap_16(uint16_t x)
uint16_t le16toh(uint16_t little_endian_16bits)
uint16_t htole16(uint16_t host_16bits)
uint64_t le64toh(uint64_t little_endian_64bits)
uint64_t bswap_64(uint64_t x)
uint16_t be16toh(uint16_t big_endian_16bits)
uint64_t htole64(uint64_t host_64bits)
uint32_t le32toh(uint32_t little_endian_32bits)