From: Ruediger Meier Date: Tue, 8 Mar 2016 09:35:58 +0000 (+0100) Subject: include/bitops: avoid fallbacks for more systems X-Git-Tag: v2.28-rc1~18^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d20eb029d52b6cd31b2a86b95d2708f505eca78a;p=thirdparty%2Futil-linux.git include/bitops: avoid fallbacks for more systems Signed-off-by: Ruediger Meier --- diff --git a/include/bitops.h b/include/bitops.h index 2d2f88d9c0..287d4af29b 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 /*