1 #ifndef PROTOZERO_BYTESWAP_HPP
2 #define PROTOZERO_BYTESWAP_HPP
30 static_assert(N == 1,
"Can only swap 4 or 8 byte values");
38 # if defined(__GNUC__) || defined(__clang__)
39 *
reinterpret_cast<uint32_t*
>(result) = __builtin_bswap32(*reinterpret_cast<const uint32_t*>(data));
53 # if defined(__GNUC__) || defined(__clang__)
54 *
reinterpret_cast<uint64_t*
>(result) = __builtin_bswap64(*reinterpret_cast<const uint64_t*>(data));
69 #endif // PROTOZERO_BYTESWAP_HPP
void byteswap< 4 >(const char *data, char *result)
Definition: byteswap.hpp:37
void byteswap< 8 >(const char *data, char *result)
Definition: byteswap.hpp:52
void byteswap(const char *, char *)
Definition: byteswap.hpp:29
All parts of the protozero header-only library are in this namespace.
Definition: byteswap.hpp:22