6 #ifndef _XDRC_ENDIAN_H_HEADER_INCLUDED_ 7 #define _XDRC_ENDIAN_H_HEADER_INCLUDED_ 1 14 #if defined(_MSC_VER) && !defined(MSVC) 16 #endif // _MSC_VER && !MSVC 21 #pragma warning(disable: 4624) 23 #pragma warning(disable: 4594) 29 if (strerror_s(buf,
sizeof(buf), no) == 0) {
30 return std::string(buf);
34 #define xdr_strerror xdr::errstr 37 #define Constexpr constexpr 38 #define xdr_strerror std::strerror 41 #ifndef XDRPP_WORDS_BIGENDIAN 43 #define XDRPP_WORDS_BIGENDIAN 0 47 #endif // !XDRPP_WORDS_BIGENDIAN 50 #if XDRPP_WORDS_BIGENDIAN 52 #else // !XDRPP_WORDS_BIGENDIAN 53 Constexpr
const bool is_big_endian =
false;
54 #endif // !XDRPP_WORDS_BIGENDIAN 61 Constexpr
inline std::uint32_t
64 return v << 24 | (v & 0xff00) << 8 | (v >> 8 & 0xff00) | v >> 24;
68 Constexpr
inline std::uint64_t
71 return std::uint64_t(
swap32(std::uint32_t(v)))<<32 |
72 std::uint64_t(
swap32(std::uint32_t(v>>32)));
77 Constexpr
inline std::uint32_t
84 Constexpr
inline std::uint32_t
91 Constexpr
inline std::uint64_t
98 Constexpr
inline std::uint64_t
106 #endif // !_XDRC_ENDIAN_H_HEADER_INCLUDED_ Constexpr const bool is_big_endian
True on big endian machines, false on little endian machines.
Constexpr std::uint32_t swap32(std::uint32_t v)
Byteswap 32-bit number.
Constexpr std::uint32_t swap32be(std::uint32_t v)
Byteswap 32-bit value only on big-endian machines.
Endianness of build machine.
Most of the xdrpp library is encapsulated in the xdr namespace.
Constexpr std::uint32_t swap32le(std::uint32_t v)
Byteswap 32-bit value only on little-endian machines, identity function on big-endian machines...
Constexpr std::uint64_t swap64be(std::uint64_t v)
Byteswap 64-bit value only on big-endian machines.
Constexpr std::uint64_t swap64le(std::uint64_t v)
Byteswap 64-bit value only on little-endian machines.
Constexpr std::uint64_t swap64(std::uint64_t v)
Byteswap 64-bit number.