aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/include/pipe/p_config.h
diff options
context:
space:
mode:
authorMatt Turner <[email protected]>2011-05-09 00:17:03 -0400
committerMichel Dänzer <[email protected]>2011-05-09 12:22:59 +0200
commit5e945863caa0df03d803eca0ddc52291b606a60d (patch)
tree4f87bbdde6b3a58445f3740a301f3ebfeb082540 /src/gallium/include/pipe/p_config.h
parentbd3ce30ee7e33663ddebe17f514341f016751a2f (diff)
p_config.h: Rely on glibc endianness definitions when available
Suggested by Julien Cristau. Signed-off-by: Matt Turner <[email protected]>
Diffstat (limited to 'src/gallium/include/pipe/p_config.h')
-rw-r--r--src/gallium/include/pipe/p_config.h12
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 74a1fa29781..d48188e24f3 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)