tom fogal wrote:
> This has been attached to bug 25663 for a bit now, but didn't get
> reviewed here. It seems like a smarter way to go about setting up
> the CPU_TO_LE32 macro, because it should do a correct but potentially
> suboptimal thing on platforms we don't know about (instead of breaking
> the build).
>
> -tom
> diff --git a/src/mesa/main/compiler.h b/src/mesa/main/compiler.h
> index a296404..7ca3c97 100644
> --- a/src/mesa/main/compiler.h
> +++ b/src/mesa/main/compiler.h
> @@ -235,15 +235,12 @@ extern "C" {
> #elif defined(__APPLE__)
> #include <CoreFoundation/CFByteOrder.h>
> #define CPU_TO_LE32( x ) CFSwapInt32HostToLittle( x )
> -#elif (defined(_AIX) || defined(__blrts))
> +#else
> #define CPU_TO_LE32( x ) x = ((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 )
> -#endif /*__linux__*/
> +#endif
> #define MESA_BIG_ENDIAN 1
> #else
> #define CPU_TO_LE32( x ) ( x )
The #define of CPU_TO_LE32( x ) seems incorrect/goofy. I think we
should make it into an inline function. The "x" terms should be "(x)"
and I don't see why the swapped result is assigned back to x.
Note that in src/mesa/drivers/dri/common/spantmp2.h CPU_TO_LE32() is
called with a non-trival argument that might be evaluated four times.
-Brian
------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev
_______________________________________________
Mesa3d-dev mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mesa3d-dev