Mesa (master): p_config.h: Rely on glibc endianness definitions when available

Michel Dänzer daenzer at kemper.freedesktop.org
Mon May 9 13:26:30 UTC 2011


Module: Mesa
Branch: master
Commit: 5e945863caa0df03d803eca0ddc52291b606a60d
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=5e945863caa0df03d803eca0ddc52291b606a60d

Author: Matt Turner <mattst88 at gmail.com>
Date:   Mon May  9 00:17:03 2011 -0400

p_config.h: Rely on glibc endianness definitions when available

Suggested by Julien Cristau.

Signed-off-by: Matt Turner <mattst88 at gmail.com>

---

 src/gallium/include/pipe/p_config.h |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/src/gallium/include/pipe/p_config.h b/src/gallium/include/pipe/p_config.h
index 74a1fa2..d48188e 100644
--- a/src/gallium/include/pipe/p_config.h
+++ b/src/gallium/include/pipe/p_config.h
@@ -111,6 +111,17 @@
  * 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)
@@ -119,6 +130,7 @@
 #define PIPE_ARCH_UNKNOWN_ENDIAN
 #endif
 
+#endif
 
 #if !defined(PIPE_OS_EMBEDDED)
 




More information about the mesa-commit mailing list