diff options
author | Nicholas Clark <nick@ccl4.org> | 2011-08-29 22:44:33 +0200 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2011-08-29 22:44:33 +0200 |
commit | 3ec04ee29e91f808602c5321a273c023912fab82 (patch) | |
tree | feee592e95dd26551de51a66c02e469f9cc1ba61 | |
parent | dfadd35bb9b3500bd024236455c399d58da19b12 (diff) | |
download | perl-smoke-me/byteorder1.tar.gz |
For MULTIARCH, infer endianness correctly on (at least) *BSD and Linuxsmoke-me/byteorder1
On (most?) *BSD <sys/types.h> sets _BYTE_ORDER, on Linux it sets __BYTE_ORDER,
to indicate a big or little endian system. These can be used to set BYTEORDER
to the correct endianness and length.
-rw-r--r-- | perl.h | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -727,13 +727,13 @@ EXTERN_C int usleep(unsigned int); #if defined(USE_CROSS_COMPILE) || defined(MULTIARCH) # undef BYTEORDER -# if defined(__LITTLE_ENDIAN__) +# if defined(__LITTLE_ENDIAN__) || (defined(_BYTE_ORDER) && _BYTE_ORDER == _LITTLE_ENDIAN) || (defined(__BYTE_ORDER) && __BYTE_ORDER == __LITTLE_ENDIAN) # if LONGSIZE == 4 # define BYTEORDER 0x1234 # elif LONGSIZE == 8 # define BYTEORDER 0x12345678 # endif -# elif defined(__BIG_ENDIAN__) +# elif defined(__BIG_ENDIAN__) || (defined(_BYTE_ORDER) && _BYTE_ORDER == _BIG_ENDIAN) || (defined(__BYTE_ORDER) && __BYTE_ORDER == __BIG_ENDIAN) # if LONGSIZE == 4 # define BYTEORDER 0x4321 # elif LONGSIZE == 8 |