From a33441c4b274d840432ba553db463cbee1f1a480 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Thu, 8 Oct 2009 14:21:08 -0700 Subject: [PATCH] byteorder: properly detect endianness --- src/include/byteorder.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/include/byteorder.h b/src/include/byteorder.h index cdd003781dd76..d65493244ae17 100644 --- a/src/include/byteorder.h +++ b/src/include/byteorder.h @@ -31,11 +31,14 @@ static __inline__ __u64 swab64(__u64 val) } // mswab == maybe swab (if not LE) -#if __BYTEORDER == __BIG_ENDIAN +#if defined(__BIG_ENDIAN__) || defined(__BIG_ENDIAN) # define mswab64(a) swab64(a) # define mswab32(a) swab32(a) # define mswab16(a) swab16(a) #else +# if !defined(__LITTLE_ENDIAN__) && !defined(__LITTLE_ENDIAN) +# warning unknown endianness, assuming little +# endif # define mswab64(a) (a) # define mswab32(a) (a) # define mswab16(a) (a) -- 2.39.5