X-Git-Url: http://git.ozlabs.org/?p=ccan;a=blobdiff_plain;f=ccan%2Fendian%2Fendian.h;h=6732e8aa8193f11a8e131a65bee1fa87fbe8495e;hp=0c99cc802db0e0acac0668d11d305fe89b4b5aed;hb=759ac0f0564104d5028acd47c3e9fdb858c96d1d;hpb=9728f1d9c26e329a13dc66a35b11fafa69ba016d diff --git a/ccan/endian/endian.h b/ccan/endian/endian.h index 0c99cc80..6732e8aa 100644 --- a/ccan/endian/endian.h +++ b/ccan/endian/endian.h @@ -103,13 +103,22 @@ static inline uint64_t bswap_64(uint64_t val) } #endif +/* Needed for Glibc like endiness check */ +#define __LITTLE_ENDIAN 1234 +#define __BIG_ENDIAN 4321 + /* Sanity check the defines. We don't handle weird endianness. */ #if !HAVE_LITTLE_ENDIAN && !HAVE_BIG_ENDIAN #error "Unknown endian" #elif HAVE_LITTLE_ENDIAN && HAVE_BIG_ENDIAN #error "Can't compile for both big and little endian." +#elif HAVE_LITTLE_ENDIAN +#define __BYTE_ORDER __LITTLE_ENDIAN +#elif HAVE_BIG_ENDIAN +#define __BYTE_ORDER __BIG_ENDIAN #endif + #ifdef __CHECKER__ /* sparse needs forcing to remove bitwise attribute from ccan/short_types */ #define ENDIAN_CAST __attribute__((force))