Mesa (master): mesa: replace questionable CPU_TO_LE32 macro with function
Brian Paul
brianp at kemper.freedesktop.org
Wed Jan 20 15:18:53 UTC 2010
Module: Mesa
Branch: master
Commit: 05208b298d218071bae75a52a16e4483ca64c94d
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=05208b298d218071bae75a52a16e4483ca64c94d
Author: Brian Paul <brianp at vmware.com>
Date: Wed Jan 20 08:02:59 2010 -0700
mesa: replace questionable CPU_TO_LE32 macro with function
---
src/mesa/main/compiler.h | 15 +++++++++------
1 files changed, 9 insertions(+), 6 deletions(-)
diff --git a/src/mesa/main/compiler.h b/src/mesa/main/compiler.h
index 9eab1ea..9cef99f 100644
--- a/src/mesa/main/compiler.h
+++ b/src/mesa/main/compiler.h
@@ -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 )
More information about the mesa-commit
mailing list