diff --git a/src/generic/endian.h b/src/generic/endian.h index f14bdb7..88cea5f 100644 --- a/src/generic/endian.h +++ b/src/generic/endian.h @@ -88,6 +88,12 @@ #include #endif +#if defined(__NetBSD__) +/* Bring bswap{16,32,64} into scope: */ +#include +#include +#endif + #if !defined(LITTLE_ENDIAN) # if defined(__ORDER_LITTLE_ENDIAN__) # define LITTLE_ENDIAN __ORDER_LITTLE_ENDIAN__ @@ -122,6 +128,8 @@ # endif #endif +#if !defined(__NetBSD__) + #if !HAVE_DECL_BSWAP16 static really_inline uint16_t bswap16(uint16_t x) { @@ -162,6 +170,8 @@ static really_inline uint64_t bswap64(uint64_t x) } #endif +#endif /* !defined(__NetBSD__) */ + # if BYTE_ORDER == LITTLE_ENDIAN # define htobe(bits, x) bswap ## bits((x)) # define htole(bits, x) (x)