5#ifndef BITCOIN_COMPAT_ENDIAN_H
6#define BITCOIN_COMPAT_ENDIAN_H
15 if constexpr (std::endian::native == std::endian::little)
return internal_bswap_16(host_16bits);
16 else return host_16bits;
20 if constexpr (std::endian::native == std::endian::big)
return internal_bswap_16(host_16bits);
21 else return host_16bits;
25 if constexpr (std::endian::native == std::endian::little)
return internal_bswap_16(big_endian_16bits);
26 else return big_endian_16bits;
30 if constexpr (std::endian::native == std::endian::big)
return internal_bswap_16(little_endian_16bits);
31 else return little_endian_16bits;
35 if constexpr (std::endian::native == std::endian::little)
return internal_bswap_32(host_32bits);
36 else return host_32bits;
40 if constexpr (std::endian::native == std::endian::big)
return internal_bswap_32(host_32bits);
41 else return host_32bits;
45 if constexpr (std::endian::native == std::endian::little)
return internal_bswap_32(big_endian_32bits);
46 else return big_endian_32bits;
50 if constexpr (std::endian::native == std::endian::big)
return internal_bswap_32(little_endian_32bits);
51 else return little_endian_32bits;
55 if constexpr (std::endian::native == std::endian::little)
return internal_bswap_64(host_64bits);
56 else return host_64bits;
60 if constexpr (std::endian::native == std::endian::big)
return internal_bswap_64(host_64bits);
61 else return host_64bits;
65 if constexpr (std::endian::native == std::endian::little)
return internal_bswap_64(big_endian_64bits);
66 else return big_endian_64bits;
70 if constexpr (std::endian::native == std::endian::big)
return internal_bswap_64(little_endian_64bits);
71 else return little_endian_64bits;
BSWAP_CONSTEXPR uint32_t internal_bswap_32(uint32_t x)
BSWAP_CONSTEXPR uint16_t internal_bswap_16(uint16_t x)
BSWAP_CONSTEXPR uint64_t internal_bswap_64(uint64_t x)
BSWAP_CONSTEXPR uint32_t be32toh_internal(uint32_t big_endian_32bits)
BSWAP_CONSTEXPR uint16_t be16toh_internal(uint16_t big_endian_16bits)
BSWAP_CONSTEXPR uint64_t htobe64_internal(uint64_t host_64bits)
BSWAP_CONSTEXPR uint16_t htobe16_internal(uint16_t host_16bits)
BSWAP_CONSTEXPR uint32_t htole32_internal(uint32_t host_32bits)
BSWAP_CONSTEXPR uint16_t htole16_internal(uint16_t host_16bits)
BSWAP_CONSTEXPR uint64_t be64toh_internal(uint64_t big_endian_64bits)
BSWAP_CONSTEXPR uint16_t le16toh_internal(uint16_t little_endian_16bits)
BSWAP_CONSTEXPR uint64_t htole64_internal(uint64_t host_64bits)
BSWAP_CONSTEXPR uint64_t le64toh_internal(uint64_t little_endian_64bits)
BSWAP_CONSTEXPR uint32_t le32toh_internal(uint32_t little_endian_32bits)
BSWAP_CONSTEXPR uint32_t htobe32_internal(uint32_t host_32bits)