[Mesa-dev] [PATCH 2/9] gallium/util: add u_bit_scan64

Marek Olšák maraeo at gmail.com
Sun Feb 1 09:15:54 PST 2015


From: Marek Olšák <marek.olsak at amd.com>

Same as u_bit_scan, but for uint64_t.
---
 src/gallium/auxiliary/util/u_math.h | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/gallium/auxiliary/util/u_math.h b/src/gallium/auxiliary/util/u_math.h
index 19c7343..f5d3487 100644
--- a/src/gallium/auxiliary/util/u_math.h
+++ b/src/gallium/auxiliary/util/u_math.h
@@ -587,6 +587,13 @@ u_bit_scan(unsigned *mask)
    return i;
 }
 
+static INLINE int
+u_bit_scan64(uint64_t *mask)
+{
+   int i = ffsll(*mask) - 1;
+   *mask &= ~(1llu << i);
+   return i;
+}
 
 /**
  * Return float bits.
-- 
2.1.0



More information about the mesa-dev mailing list