aboutsummaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2019-08-05 15:03:18 -0700
committerChris Robinson <[email protected]>2019-08-05 15:03:18 -0700
commite286ec8d09b8d0a1939bca9eaa196514347282b1 (patch)
tree23050faca3ea3280a2d9a16b5cbac9ad4f5bc48e /common
parentd24401c3f3fbed3f0aa7fd5e4777e0d83797fa10 (diff)
Move some declarations out of alcmain.h
Diffstat (limited to 'common')
-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 */