aboutsummaryrefslogtreecommitdiffstats
path: root/tools/include/endian.h
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2006-10-13 20:51:49 +0000
committerFelix Fietkau <nbd@openwrt.org>2006-10-13 20:51:49 +0000
commit5b2f37e0cd7ef98a06611fb42b947d8984f0e12a (patch)
treed993cf48b4d89166701fe2f33976389d7634235d /tools/include/endian.h
parent79c3b44dbfbd6fb819a0daf64c2b797c29b04d85 (diff)
parent4b8e77121f1bcca81025c3fcb7b87bf869bef7f9 (diff)
downloadupstream-5b2f37e0cd7ef98a06611fb42b947d8984f0e12a.tar.gz
upstream-5b2f37e0cd7ef98a06611fb42b947d8984f0e12a.tar.bz2
upstream-5b2f37e0cd7ef98a06611fb42b947d8984f0e12a.zip
finally move buildroot-ng to trunk
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@5059 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'tools/include/endian.h')
-rw-r--r--tools/include/endian.h34
1 files changed, 34 insertions, 0 deletions
diff --git a/tools/include/endian.h b/tools/include/endian.h
new file mode 100644
index 0000000000..9bfc652b90
--- /dev/null
+++ b/tools/include/endian.h
@@ -0,0 +1,34 @@
+#ifndef __endian_compat_h
+#define __endian_compat_h
+
+#if defined(__linux__)
+#include_next <endian.h>
+#elif defined(__APPLE__)
+#include <machine/endian.h>
+#include <machine/byte_order.h>
+#define bswap_16(x) NXSwapShort(x)
+#define bswap_32(x) NXSwapInt(x)
+#define bswap_64(x) NXSwapLongLong(x)
+#elif defined(__FreeBSD__)
+#include <sys/endian.h>
+#define bswap_16(x) bswap16(x)
+#define bswap_32(x) bswap32(x)
+#define bswap_64(x) bswap64(x)
+#else
+#include <machine/endian.h>
+#define bswap_16(x) swap16(x)
+#define bswap_32(x) swap32(x)
+#define bswap_64(x) swap64(x)
+#endif
+
+#ifndef __BYTE_ORDER
+#define __BYTE_ORDER BYTE_ORDER
+#endif
+#ifndef __BIG_ENDIAN
+#define __BIG_ENDIAN BIG_ENDIAN
+#endif
+#ifndef __LITTLE_ENDIAN
+#define __LITTLE_ENDIAN LITTLE_ENDIAN
+#endif
+
+#endif