Don't assume the total length of certain arrays
[openal-soft.git] / common / endiantest.h
blob0a20eb918bd7bcc2f2a621e6f35182cec11e12ba
1 #ifndef AL_ENDIANTEST_H
2 #define AL_ENDIANTEST_H
4 #if defined(__BYTE_ORDER__) && defined(__ORDER_LITTLE_ENDIAN__)
5 #define IS_LITTLE_ENDIAN (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)
6 #else
7 static const union {
8 unsigned int u;
9 unsigned char b[sizeof(unsigned int)];
10 } EndianTest = { 1 };
11 #define IS_LITTLE_ENDIAN (EndianTest.b[0] == 1)
12 #endif
14 #endif /* AL_ENDIANTEST_H */