summaryrefslogtreecommitdiff
path: root/src/embtk
diff options
context:
space:
mode:
authorAbdoulaye Walsimou GAYE <awg@embtoolkit.org>2014-10-26 10:06:22 +0100
committerAbdoulaye Walsimou GAYE <awg@embtoolkit.org>2014-10-26 10:06:22 +0100
commit0e3a3ccb7b66130fdfbcd9ff3a233ed5d03c6951 (patch)
tree63c112d36c001f07747dc40b4a946ad0fc58de1d /src/embtk
parent27c66d4e0d7fb6884e7c4f44578e0acc4e0c2cdd (diff)
downloadembtoolkit-0e3a3ccb7b66130fdfbcd9ff3a233ed5d03c6951.tar.gz
embtoolkit-0e3a3ccb7b66130fdfbcd9ff3a233ed5d03c6951.tar.bz2
embtoolkit-0e3a3ccb7b66130fdfbcd9ff3a233ed5d03c6951.tar.xz
Build system: Host tools: add a compatibility src headers
Signed-off-by: Abdoulaye Walsimou GAYE <awg@embtoolkit.org>
Diffstat (limited to 'src/embtk')
-rw-r--r--src/embtk/.DS_Storebin0 -> 6148 bytes
-rw-r--r--src/embtk/include/.DS_Storebin0 -> 6148 bytes
-rw-r--r--src/embtk/include/byteswap.h5
-rw-r--r--src/embtk/include/endian.h40
4 files changed, 45 insertions, 0 deletions
diff --git a/src/embtk/.DS_Store b/src/embtk/.DS_Store
new file mode 100644
index 0000000..acaf686
--- /dev/null
+++ b/src/embtk/.DS_Store
Binary files differ
diff --git a/src/embtk/include/.DS_Store b/src/embtk/include/.DS_Store
new file mode 100644
index 0000000..89b35b6
--- /dev/null
+++ b/src/embtk/include/.DS_Store
Binary files differ
diff --git a/src/embtk/include/byteswap.h b/src/embtk/include/byteswap.h
new file mode 100644
index 0000000..1a187fe
--- /dev/null
+++ b/src/embtk/include/byteswap.h
@@ -0,0 +1,5 @@
+#if defined(__linux__)
+#include_next <byteswap.h>
+#else
+#include <endian.h>
+#endif
diff --git a/src/embtk/include/endian.h b/src/embtk/include/endian.h
new file mode 100644
index 0000000..6b446d3
--- /dev/null
+++ b/src/embtk/include/endian.h
@@ -0,0 +1,40 @@
+#ifndef __endian_compat_h
+#define __endian_compat_h
+
+#if defined(__linux__)
+#include <byteswap.h>
+#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)
+#elif defined(__OpenBSD__)
+#include <sys/types.h>
+#define bswap_16(x) __swap16(x)
+#define bswap_32(x) __swap32(x)
+#define bswap_64(x) __swap64(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