gallium/util: add u_bit_scan64
authorMarek Olšák <marek.olsak@amd.com>
Sat, 31 Jan 2015 16:15:16 +0000 (17:15 +0100)
committerMarek Olšák <marek.olsak@amd.com>
Wed, 4 Feb 2015 13:34:13 +0000 (14:34 +0100)
Same as u_bit_scan, but for uint64_t.

Reviewed-by: Glenn Kennard <glenn.kennard@gmail.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
src/gallium/auxiliary/util/u_math.h

index ca6d0f1dfc845335c13653605920332ecbd67da4..8eb840f1ec0fa4ee5712ac71e8d528588f5e77f2 100644 (file)
@@ -583,6 +583,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.