take byte order from gcc if gcc has defined it

this only works with gcc 4.6 and later, but it allows us to support
non-default endianness on archs like arm, mips, ppc, etc. that can do
both without having separate header sets for both variants, and it
saves one #include even on fixed-endianness archs like x86.
This commit is contained in:
Rich Felker 2012-05-06 13:40:19 -04:00
parent a45de0cb94
commit a3b20f67b3
1 changed files with 4 additions and 0 deletions

View File

@ -5,7 +5,11 @@
#define __BIG_ENDIAN 4321
#define __PDP_ENDIAN 3412
#if defined(__GNUC__) && defined(__BYTE_ORDER__)
#define __BYTE_ORDER __BYTE_ORDER__
#else
#include <bits/endian.h>
#endif
#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)