Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

endian.h: fix so that this builds on NetBSD again. #233

Merged
merged 1 commit into from
Sep 22, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions src/generic/endian.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,12 @@
#include <sys/endian.h>
#endif

#if defined(__NetBSD__)
/* Bring bswap{16,32,64} into scope: */
#include <sys/types.h>
#include <machine/bswap.h>
#endif

#if !defined(LITTLE_ENDIAN)
# if defined(__ORDER_LITTLE_ENDIAN__)
# define LITTLE_ENDIAN __ORDER_LITTLE_ENDIAN__
Expand Down Expand Up @@ -122,6 +128,8 @@
# endif
#endif

#if !defined(__NetBSD__)

#if !HAVE_DECL_BSWAP16
static really_inline uint16_t bswap16(uint16_t x)
{
Expand Down Expand Up @@ -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)
Expand Down
Loading