]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
byteorder: properly detect endianness
authorSage Weil <sage@newdream.net>
Thu, 8 Oct 2009 21:21:08 +0000 (14:21 -0700)
committerSage Weil <sage@newdream.net>
Thu, 8 Oct 2009 21:21:08 +0000 (14:21 -0700)
src/include/byteorder.h

index cdd003781dd763c6f69a1cfeb7d55c1f5dd7454f..d65493244ae17a81b5d3c73c74ec9d313889b91a 100644 (file)
@@ -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)