summaryrefslogtreecommitdiff
path: root/adk
diff options
context:
space:
mode:
authorWaldemar Brodkorb <wbx@openadk.org>2016-05-13 08:55:59 +0200
committerWaldemar Brodkorb <wbx@openadk.org>2016-05-13 08:56:08 +0200
commitc201a77de667d207b4d150cbecc5a9225336de47 (patch)
tree0a0c75dd4591e3601e2dddc3d06d69740bf65df2 /adk
parent84bce194674cc57e556ec52826a6014518eb4dd1 (diff)
fix building for imgtec ci20, add helper header for Darwin
Diffstat (limited to 'adk')
-rw-r--r--adk/include/byteswap.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/adk/include/byteswap.h b/adk/include/byteswap.h
new file mode 100644
index 000000000..f557cd468
--- /dev/null
+++ b/adk/include/byteswap.h
@@ -0,0 +1,18 @@
+#if defined(__linux__) || defined(__CYGWIN__)
+#include_next <byteswap.h>
+#else
+static inline unsigned short bswap_16(unsigned short val)
+{
+ return ((val & 0xff) << 8) | ((val >> 8) & 0xff);
+}
+static inline unsigned long bswap_32(unsigned long val)
+{
+ return bswap_16((unsigned short)val) << 16 |
+ bswap_16((unsigned short)(val >> 16));
+}
+static inline unsigned long long bswap_64(unsigned long long val)
+{
+ return ((((unsigned long long)bswap_32(val)) << 32) |
+ (((unsigned long long)bswap_32(val >> 32)) & 0xffffffffULL));
+}
+#endif