5 #ifndef BITCOIN_COMPAT_ENDIAN_H 6 #define BITCOIN_COMPAT_ENDIAN_H 8 #if defined(HAVE_CONFIG_H) 16 #if defined(HAVE_ENDIAN_H) 18 #elif defined(HAVE_SYS_ENDIAN_H) 19 #include <sys/endian.h> 27 #define HAVE_DECL_HTOBE16 1 30 #define HAVE_DECL_HTOLE16 1 33 #define HAVE_DECL_BE16TOH 1 36 #define HAVE_DECL_LE16TOH 1 40 #define HAVE_DECL_HTOBE32 1 43 #define HAVE_DECL_HTOLE32 1 46 #define HAVE_DECL_BE32TOH 1 49 #define HAVE_DECL_LE32TOH 1 53 #define HAVE_DECL_HTOBE64 1 56 #define HAVE_DECL_HTOLE64 1 59 #define HAVE_DECL_BE64TOH 1 62 #define HAVE_DECL_LE64TOH 1 65 #endif // HAVE_CONFIG_H 67 #if defined(WORDS_BIGENDIAN) 69 #if HAVE_DECL_HTOBE16 == 0 74 #endif // HAVE_DECL_HTOBE16 76 #if HAVE_DECL_HTOLE16 == 0 81 #endif // HAVE_DECL_HTOLE16 83 #if HAVE_DECL_BE16TOH == 0 86 return big_endian_16bits;
88 #endif // HAVE_DECL_BE16TOH 90 #if HAVE_DECL_LE16TOH == 0 93 return bswap_16(little_endian_16bits);
95 #endif // HAVE_DECL_LE16TOH 97 #if HAVE_DECL_HTOBE32 == 0 102 #endif // HAVE_DECL_HTOBE32 104 #if HAVE_DECL_HTOLE32 == 0 109 #endif // HAVE_DECL_HTOLE32 111 #if HAVE_DECL_BE32TOH == 0 114 return big_endian_32bits;
116 #endif // HAVE_DECL_BE32TOH 118 #if HAVE_DECL_LE32TOH == 0 121 return bswap_32(little_endian_32bits);
123 #endif // HAVE_DECL_LE32TOH 125 #if HAVE_DECL_HTOBE64 == 0 130 #endif // HAVE_DECL_HTOBE64 132 #if HAVE_DECL_HTOLE64 == 0 137 #endif // HAVE_DECL_HTOLE64 139 #if HAVE_DECL_BE64TOH == 0 142 return big_endian_64bits;
144 #endif // HAVE_DECL_BE64TOH 146 #if HAVE_DECL_LE64TOH == 0 149 return bswap_64(little_endian_64bits);
151 #endif // HAVE_DECL_LE64TOH 153 #else // WORDS_BIGENDIAN 155 #if HAVE_DECL_HTOBE16 == 0 160 #endif // HAVE_DECL_HTOBE16 162 #if HAVE_DECL_HTOLE16 == 0 167 #endif // HAVE_DECL_HTOLE16 169 #if HAVE_DECL_BE16TOH == 0 174 #endif // HAVE_DECL_BE16TOH 176 #if HAVE_DECL_LE16TOH == 0 179 return little_endian_16bits;
181 #endif // HAVE_DECL_LE16TOH 183 #if HAVE_DECL_HTOBE32 == 0 188 #endif // HAVE_DECL_HTOBE32 190 #if HAVE_DECL_HTOLE32 == 0 195 #endif // HAVE_DECL_HTOLE32 197 #if HAVE_DECL_BE32TOH == 0 202 #endif // HAVE_DECL_BE32TOH 204 #if HAVE_DECL_LE32TOH == 0 207 return little_endian_32bits;
209 #endif // HAVE_DECL_LE32TOH 211 #if HAVE_DECL_HTOBE64 == 0 216 #endif // HAVE_DECL_HTOBE64 218 #if HAVE_DECL_HTOLE64 == 0 223 #endif // HAVE_DECL_HTOLE64 225 #if HAVE_DECL_BE64TOH == 0 230 #endif // HAVE_DECL_BE64TOH 232 #if HAVE_DECL_LE64TOH == 0 235 return little_endian_64bits;
237 #endif // HAVE_DECL_LE64TOH 239 #endif // WORDS_BIGENDIAN 241 #endif // BITCOIN_COMPAT_ENDIAN_H uint64_t htobe64(uint64_t host_64bits)
Definition: endian.h:212
unsigned short uint16_t
Definition: stdint.h:20
uint32_t be32toh(uint32_t big_endian_32bits)
Definition: endian.h:198
uint32_t htole32(uint32_t host_32bits)
Definition: endian.h:191
uint32_t bswap_32(uint32_t x)
Definition: byteswap.h:43
uint32_t htobe32(uint32_t host_32bits)
Definition: endian.h:184
uint64_t be64toh(uint64_t big_endian_64bits)
Definition: endian.h:226
unsigned int uint32_t
Definition: stdint.h:21
unsigned long long uint64_t
Definition: stdint.h:22
uint16_t htobe16(uint16_t host_16bits)
Definition: endian.h:156
uint16_t bswap_16(uint16_t x)
Definition: byteswap.h:36
uint16_t le16toh(uint16_t little_endian_16bits)
Definition: endian.h:177
uint16_t htole16(uint16_t host_16bits)
Definition: endian.h:163
uint64_t le64toh(uint64_t little_endian_64bits)
Definition: endian.h:233
uint64_t bswap_64(uint64_t x)
Definition: byteswap.h:51
uint16_t be16toh(uint16_t big_endian_16bits)
Definition: endian.h:170
uint64_t htole64(uint64_t host_64bits)
Definition: endian.h:219
uint32_t le32toh(uint32_t little_endian_32bits)
Definition: endian.h:205