From d20eb029d52b6cd31b2a86b95d2708f505eca78a Mon Sep 17 00:00:00 2001 From: Ruediger Meier Date: Tue, 8 Mar 2016 10:35:58 +0100 Subject: [PATCH] include/bitops: avoid fallbacks for more systems Signed-off-by: Ruediger Meier --- include/bitops.h | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/include/bitops.h b/include/bitops.h index 2d2f88d9c..287d4af29 100644 --- a/include/bitops.h +++ b/include/bitops.h @@ -25,6 +25,27 @@ # define be16toh(x) betoh16(x) # define be32toh(x) betoh32(x) # define be64toh(x) betoh64(x) +#elif defined(__NetBSD__) || defined(__FreeBSD__) || defined(__DragonFly__) +# define bswap_16(x) bswap16(x) +# define bswap_32(x) bswap32(x) +# define bswap_64(x) bswap64(x) +#elif defined(__APPLE__) +# include +# define htobe16(x) OSSwapHostToBigInt16(x) +# define htole16(x) OSSwapHostToLittleInt16(x) +# define be16toh(x) OSSwapBigToHostInt16(x) +# define le16toh(x) OSSwapLittleToHostInt16(x) +# define htobe32(x) OSSwapHostToBigInt32(x) +# define htole32(x) OSSwapHostToLittleInt32(x) +# define be32toh(x) OSSwapBigToHostInt32(x) +# define le32toh(x) OSSwapLittleToHostInt32(x) +# define htobe64(x) OSSwapHostToBigInt64(x) +# define htole64(x) OSSwapHostToLittleInt64(x) +# define be64toh(x) OSSwapBigToHostInt64(x) +# define le64toh(x) OSSwapLittleToHostInt64(x) +# define bswap_16(x) OSSwapInt16(x) +# define bswap_32(x) OSSwapInt32(x) +# define bswap_64(x) OSSwapInt64(x) #endif /*