aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/gallium/auxiliary/util/u_math.h
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2011-09-26 17:04:30 +0200
committermarha <marha@users.sourceforge.net>2011-09-26 17:04:30 +0200
commit873965b49f283ad028dd4e0e5b7e93a758c84993 (patch)
tree84122d76cb641b54ea85cee9b631fb51c25052b5 /mesalib/src/gallium/auxiliary/util/u_math.h
parentc1e6c7428a8d2c1b60ffac7df7a3f56c300fa983 (diff)
downloadvcxsrv-873965b49f283ad028dd4e0e5b7e93a758c84993.tar.gz
vcxsrv-873965b49f283ad028dd4e0e5b7e93a758c84993.tar.bz2
vcxsrv-873965b49f283ad028dd4e0e5b7e93a758c84993.zip
fontconfig libX11 libXext libXft libXmu mesa git update 26 sep 2011
Diffstat (limited to 'mesalib/src/gallium/auxiliary/util/u_math.h')
-rw-r--r--mesalib/src/gallium/auxiliary/util/u_math.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/mesalib/src/gallium/auxiliary/util/u_math.h b/mesalib/src/gallium/auxiliary/util/u_math.h
index 46d932293..c74c1da76 100644
--- a/mesalib/src/gallium/auxiliary/util/u_math.h
+++ b/mesalib/src/gallium/auxiliary/util/u_math.h
@@ -424,6 +424,22 @@ unsigned ffs( unsigned u )
#endif
+/* Destructively loop over all of the bits in a mask as in:
+ *
+ * while (mymask) {
+ * int i = u_bit_scan(&mymask);
+ * ... process element i
+ * }
+ *
+ */
+static INLINE int u_bit_scan(unsigned *mask)
+{
+ int i = ffs(*mask) - 1;
+ *mask &= ~(1 << i);
+ return i;
+}
+
+
/**
* Return float bits.
*/