summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/glheader.h
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2002-06-12 00:52:50 +0000
committerBrian Paul <[email protected]>2002-06-12 00:52:50 +0000
commit1013e4650473ef0aceac7f3cd571b982ff249250 (patch)
treec87f4e1385cd453e5ac5e1596a7d10b0b3d0c56e /src/mesa/main/glheader.h
parent35883ceb9389f9e5b4be8233f2326367c6aecddb (diff)
Moved big/little endian code to glheader.h.
Define either MESA_BIG_ENDIAN or MESA_LITTLE_ENDIAN.
Diffstat (limited to 'src/mesa/main/glheader.h')
-rw-r--r--src/mesa/main/glheader.h23
1 files changed, 22 insertions, 1 deletions
diff --git a/src/mesa/main/glheader.h b/src/mesa/main/glheader.h
index 9f9f3edea96..3a66f618a20 100644
--- a/src/mesa/main/glheader.h
+++ b/src/mesa/main/glheader.h
@@ -1,4 +1,4 @@
-/* $Id: glheader.h,v 1.25 2002/03/23 01:49:58 brianp Exp $ */
+/* $Id: glheader.h,v 1.26 2002/06/12 00:52:50 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -162,6 +162,27 @@ typedef struct tagPIXELFORMATDESCRIPTOR PIXELFORMATDESCRIPTOR, *PPIXELFORMATDESC
#endif
+/*
+ * Either define MESA_BIG_ENDIAN or MESA_LITTLE_ENDIAN.
+ * Do not use them unless absolutely necessary!
+ * Try to use a runtime test instead.
+ * For now, only used by some DRI hardware drivers for color/texel packing.
+ */
+#if defined(BYTE_ORDER) && defined(BIG_ENDIAN) && BYTE_ORDER == BIG_ENDIAN
+#if defined(__linux__)
+#include <byteswap.h>
+#define CPU_TO_LE32( x ) bswap_32( x )
+#else /*__linux__*/
+#define CPU_TO_LE32( x ) ( x ) /* fix me for non-Linux big-endian! */
+#endif /*__linux__*/
+#define MESA_BIG_ENDIAN 1
+#else
+#define CPU_TO_LE32( x ) ( x )
+#define MESA_LITTLE_ENDIAN 1
+#endif
+#define LE32_TO_CPU( x ) CPU_TO_LE32( x )
+
+
/* This is a macro on IRIX */
#ifdef _P
#undef _P