Commit 696c9b68 authored by Rusty Russell's avatar Rusty Russell

endian: fix compilation with musl libc.

It defines __BYTE_ORDER to __BYTE_ORDER__; gcc complains when we define
it to something else.  Let it be already defined, but check that the
value is what we expect.
Signed-off-by: default avatarRusty Russell <rusty@rustcorp.com.au>
parent 5a15d1aa
...@@ -113,9 +113,17 @@ static inline uint64_t bswap_64(uint64_t val) ...@@ -113,9 +113,17 @@ static inline uint64_t bswap_64(uint64_t val)
#elif HAVE_LITTLE_ENDIAN && HAVE_BIG_ENDIAN #elif HAVE_LITTLE_ENDIAN && HAVE_BIG_ENDIAN
#error "Can't compile for both big and little endian." #error "Can't compile for both big and little endian."
#elif HAVE_LITTLE_ENDIAN #elif HAVE_LITTLE_ENDIAN
#ifndef __BYTE_ORDER
#define __BYTE_ORDER __LITTLE_ENDIAN #define __BYTE_ORDER __LITTLE_ENDIAN
#elif __BYTE_ORDER != __LITTLE_ENDIAN
#error "__BYTE_ORDER already defined, but not equal to __LITTLE_ENDIAN"
#endif
#elif HAVE_BIG_ENDIAN #elif HAVE_BIG_ENDIAN
#ifndef __BYTE_ORDER
#define __BYTE_ORDER __BIG_ENDIAN #define __BYTE_ORDER __BIG_ENDIAN
#elif __BYTE_ORDER != __BIG_ENDIAN
#error "__BYTE_ORDER already defined, but not equal to __BIG_ENDIAN"
#endif
#endif #endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment