From 1013e4650473ef0aceac7f3cd571b982ff249250 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 12 Jun 2002 00:52:50 +0000 Subject: Moved big/little endian code to glheader.h. Define either MESA_BIG_ENDIAN or MESA_LITTLE_ENDIAN. --- src/mesa/main/glheader.h | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) (limited to 'src/mesa/main/glheader.h') diff --git a/src/mesa/main/glheader.h b/src/mesa/main/glheader.h index 9f9f3edea9..3a66f618a2 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 +#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 -- cgit v1.2.3