Hi. Now that there's util_bitcount in u_math, I'd like to have a bswap
helper as well,
I need to swap the stipple pattern on nv50. Any objections ?
Christoph
>From c5cd44843e45b37fac4aef1ebc494ab12ccfe54d Mon Sep 17 00:00:00 2001
From: Christoph Bumiller <[email protected]>
Date: Thu, 26 Nov 2009 16:58:59 +0100
Subject: [PATCH 2/4] gallium/util: added util_bswap32()
---
src/gallium/auxiliary/util/u_math.h | 17 +++++++++++++++++
1 files changed, 17 insertions(+), 0 deletions(-)
diff --git a/src/gallium/auxiliary/util/u_math.h
b/src/gallium/auxiliary/util/u_math.h
index 9ed1ab6..4df3709 100644
--- a/src/gallium/auxiliary/util/u_math.h
+++ b/src/gallium/auxiliary/util/u_math.h
@@ -511,6 +511,23 @@ util_bitcount(unsigned n)
/**
+ * Reverse byte order of a 32 bit word.
+ */
+static INLINE uint32_t
+util_bswap32(uint32_t n)
+{
+#if defined(PIPE_CC_GCC)
+ return __builtin_bswap32(n);
+#else
+ return (n >> 24) |
+ ((n >> 8) & 0x0000ff00) |
+ ((n << 8) & 0x00ff0000) |
+ (n << 24);
+#endif
+}
+
+
+/**
* Clamp X to [MIN, MAX].
* This is a macro to allow float, int, uint, etc. types.
*/
--
1.6.4.4
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________
Mesa3d-dev mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mesa3d-dev