aboutsummaryrefslogtreecommitdiffstats
path: root/common/endiantest.h
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2019-12-12 19:21:00 +0100
committerSven Gothel <[email protected]>2019-12-12 19:21:00 +0100
commit4df06c6894b39af5bf4681c0acf0c1c080084c80 (patch)
tree2505eb6e3b5798db34033c4cac2d4613bf6bda44 /common/endiantest.h
parent8915501ed02eac2b3bce9a7fc06cb1ab562901c3 (diff)
parentc0cf323e1d56ce605e90927324d2fdafcfbb564a (diff)
merge v1.20.0
Diffstat (limited to 'common/endiantest.h')
-rw-r--r--common/endiantest.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/common/endiantest.h b/common/endiantest.h
new file mode 100644
index 00000000..0a20eb91
--- /dev/null
+++ b/common/endiantest.h
@@ -0,0 +1,14 @@
+#ifndef AL_ENDIANTEST_H
+#define AL_ENDIANTEST_H
+
+#if defined(__BYTE_ORDER__) && defined(__ORDER_LITTLE_ENDIAN__)
+#define IS_LITTLE_ENDIAN (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)
+#else
+static const union {
+ unsigned int u;
+ unsigned char b[sizeof(unsigned int)];
+} EndianTest = { 1 };
+#define IS_LITTLE_ENDIAN (EndianTest.b[0] == 1)
+#endif
+
+#endif /* AL_ENDIANTEST_H */