summaryrefslogtreecommitdiffstats
path: root/tools/include/endian.h
diff options
context:
space:
mode:
authornbd <nbd@3c298f89-4303-0410-b956-a3cf2f4a3e73>2006-09-27 17:03:36 +0000
committernbd <nbd@3c298f89-4303-0410-b956-a3cf2f4a3e73>2006-09-27 17:03:36 +0000
commit652d9073459fce55104f0db8f64fc5b9100c979d (patch)
tree383d10976ebfed64d1ca7a7d25bffd6635876626 /tools/include/endian.h
parent44af1866aa41cfbbad48583106cb82201ded4fcb (diff)
add portability fixes for toolchain/tools (full tools/toolchain build works on osx now)
git-svn-id: svn://svn.openwrt.org/openwrt/branches/buildroot-ng/openwrt@4867 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'tools/include/endian.h')
-rw-r--r--tools/include/endian.h29
1 files changed, 29 insertions, 0 deletions
diff --git a/tools/include/endian.h b/tools/include/endian.h
new file mode 100644
index 000000000..4ea34cdd0
--- /dev/null
+++ b/tools/include/endian.h
@@ -0,0 +1,29 @@
+#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)
+#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