On 21/08/12(Tue) 07:30, Brad Smith wrote:
> On Tue, Aug 21, 2012 at 01:12:28PM +0200, Martin Pieuchot wrote:
> > Diff below correctly defines the CPU_TO_LE32() macro for needed for
> > big-endian machines on OpenBSD. This is required to use dri on macppc.
> >
> > I'll do the necessary to get this upstream once it's in our tree.
> >
> > Tested with the r200 driver, ok?
> >
> > Martin
>
> bswap32 == swap32 for OpenBSD.
>
> I think it would be better if you used swap32() here.
You're right, because right after there is:
#define LE32_TO_CPU( x ) CPU_TO_LE32( x )
Ok for this one?
Martin
Index: src/mesa/main//compiler.h
===================================================================
RCS file: /cvs/xenocara/dist/Mesa/src/mesa/main/compiler.h,v
retrieving revision 1.3
diff -u -p -r1.3 compiler.h
--- src/mesa/main//compiler.h 17 Aug 2012 13:58:17 -0000 1.3
+++ src/mesa/main//compiler.h 21 Aug 2012 11:45:10 -0000
@@ -263,6 +263,9 @@ static INLINE GLuint CPU_TO_LE32(GLuint
((x & 0x00ff0000) >> 8) |
((x & 0xff000000) >> 24));
}
+#elif defined(__OpenBSD__)
+#include <sys/types.h>
+#define CPU_TO_LE32( x ) swap32( x )
#else /*__linux__ */
#include <sys/endian.h>
#define CPU_TO_LE32( x ) bswap32( x )