Skip to content

Commit 9a595d5

Browse files
he32k0ekk0ek
authored andcommitted
endian.h: fix so that this builds on NetBSD again.
A little ironic, since parts of this code is *from* NetBSD.
1 parent 7efedd6 commit 9a595d5

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/generic/endian.h

+10
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,12 @@
8888
#include <sys/endian.h>
8989
#endif
9090

91+
#if defined(__NetBSD__)
92+
/* Bring bswap{16,32,64} into scope: */
93+
#include <sys/types.h>
94+
#include <machine/bswap.h>
95+
#endif
96+
9197
#if !defined(LITTLE_ENDIAN)
9298
# if defined(__ORDER_LITTLE_ENDIAN__)
9399
# define LITTLE_ENDIAN __ORDER_LITTLE_ENDIAN__
@@ -122,6 +128,8 @@
122128
# endif
123129
#endif
124130

131+
#if !defined(__NetBSD__)
132+
125133
#if !HAVE_DECL_BSWAP16
126134
static really_inline uint16_t bswap16(uint16_t x)
127135
{
@@ -162,6 +170,8 @@ static really_inline uint64_t bswap64(uint64_t x)
162170
}
163171
#endif
164172

173+
#endif /* !defined(__NetBSD__) */
174+
165175
# if BYTE_ORDER == LITTLE_ENDIAN
166176
# define htobe(bits, x) bswap ## bits((x))
167177
# define htole(bits, x) (x)

0 commit comments

Comments
 (0)