]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
include/bitops: avoid fallbacks for more systems
authorRuediger Meier <ruediger.meier@ga-group.nl>
Tue, 8 Mar 2016 09:35:58 +0000 (10:35 +0100)
committerRuediger Meier <ruediger.meier@ga-group.nl>
Tue, 8 Mar 2016 13:55:38 +0000 (14:55 +0100)
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
include/bitops.h

index 2d2f88d9c01964f4af0b3e6bafc0f241f3a8e8b9..287d4af29b88729362f57606119f8fefa0f423d4 100644 (file)
 # 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 <libkern/OSByteOrder.h>
+# 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
 
 /*