openal-soft/common/endiantest.h
2019-08-05 15:03:18 -07:00

15 lines
379 B
C

#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 */