Skip to content

Commit

Permalink
Use endian.h for BSD native bitswaps
Browse files Browse the repository at this point in the history
  • Loading branch information
hoffmang9 committed Dec 31, 2020
1 parent d80edb2 commit 6657791
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/util.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,15 @@ std::ostream &operator<<(std::ostream &strm, uint128_t const &v)
#define bswap_16(x) OSSwapInt16(x)
#define bswap_32(x) OSSwapInt32(x)
#define bswap_64(x) OSSwapInt64(x)
#elif defined(BSD) || defined(_SYSTYPE_BSD)
# if defined(__OpenBSD__)
# include <machine/endian.h>
# else
# include <sys/endian.h>
# endif
#define bswap_16(x) bswap_16(x)
#define bswap_32(x) bswap_16(x)
#define bswap_64(x) bswap_16(x)
#else
#include <byteswap.h>
#endif
Expand Down

0 comments on commit 6657791

Please sign in to comment.