mesa: replace questionable CPU_TO_LE32 macro with function

This commit is contained in:
Brian Paul 2010-01-20 08:02:59 -07:00
parent 506e27b972
commit 05208b298d
1 changed files with 9 additions and 6 deletions

View File

@ -223,8 +223,8 @@ extern "C" {
/**
* Either define MESA_BIG_ENDIAN or MESA_LITTLE_ENDIAN.
* Do not use them unless absolutely necessary!
* Either define MESA_BIG_ENDIAN or MESA_LITTLE_ENDIAN, and CPU_TO_LE32.
* Do not use these unless absolutely necessary!
* Try to use a runtime test instead.
* For now, only used by some DRI hardware drivers for color/texel packing.
*/
@ -236,10 +236,13 @@ extern "C" {
#include <CoreFoundation/CFByteOrder.h>
#define CPU_TO_LE32( x ) CFSwapInt32HostToLittle( x )
#elif (defined(_AIX) || defined(__blrts))
#define CPU_TO_LE32( x ) x = ((x & 0x000000ff) << 24) | \
((x & 0x0000ff00) << 8) | \
((x & 0x00ff0000) >> 8) | \
((x & 0xff000000) >> 24);
static INLINE GLuint CPU_TO_LE32(GLuint x)
{
return (((x & 0x000000ff) << 24) |
((x & 0x0000ff00) << 8) |
((x & 0x00ff0000) >> 8) |
((x & 0xff000000) >> 24));
}
#else /*__linux__ */
#include <sys/endian.h>
#define CPU_TO_LE32( x ) bswap32( x )