p_config.h: Rely on glibc endianness definitions when available
authorMatt Turner <mattst88@gmail.com>
Mon, 9 May 2011 04:17:03 +0000 (00:17 -0400)
committerMichel Dänzer <daenzer@vmware.com>
Mon, 9 May 2011 10:22:59 +0000 (12:22 +0200)
Suggested by Julien Cristau.

Signed-off-by: Matt Turner <mattst88@gmail.com>
src/gallium/include/pipe/p_config.h

index 74a1fa297812c277d4f46c3b828b79b2fe4b7de7..d48188e24f310990d0c3f1c5e4e8742eca6a3517 100644 (file)
  * Endian detection.
  */
 
+#ifdef __GLIBC__
+#include <endian.h>
+
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+# define PIPE_ARCH_LITTLE_ENDIAN
+#elif __BYTE_ORDER == __BIG_ENDIAN
+# define PIPE_ARCH_BIG_ENDIAN
+#endif
+
+#else
+
 #if defined(PIPE_ARCH_X86) || defined(PIPE_ARCH_X86_64)
 #define PIPE_ARCH_LITTLE_ENDIAN
 #elif defined(PIPE_ARCH_PPC) || defined(PIPE_ARCH_PPC_64)
 #define PIPE_ARCH_UNKNOWN_ENDIAN
 #endif
 
+#endif
 
 #if !defined(PIPE_OS_EMBEDDED)