summaryrefslogtreecommitdiffstats
path: root/src/gallium/auxiliary/util/u_math.h
diff options
context:
space:
mode:
authorBas Nieuwenhuizen <[email protected]>2016-04-13 23:30:55 +0200
committerBas Nieuwenhuizen <[email protected]>2016-04-19 18:10:30 +0200
commit0b6c463dac4a25c927f419e65023979cc45ce60d (patch)
treefe06a447ef5f4f2cb82c0a54d6f6348833612b5a /src/gallium/auxiliary/util/u_math.h
parent058b54c6244416e47ec211e2300624cd9e3ae623 (diff)
gallium/util: Add u_bit_scan_consecutive_range64.
For use by radeonsi. v2: Make sure that it works for all 64 bits set. Signed-off-by: Bas Nieuwenhuizen <[email protected]> Reviewed-by: Marek Olšák <[email protected]>
Diffstat (limited to 'src/gallium/auxiliary/util/u_math.h')
-rw-r--r--src/gallium/auxiliary/util/u_math.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/gallium/auxiliary/util/u_math.h b/src/gallium/auxiliary/util/u_math.h
index d983af33203..10f158b7086 100644
--- a/src/gallium/auxiliary/util/u_math.h
+++ b/src/gallium/auxiliary/util/u_math.h
@@ -529,6 +529,20 @@ u_bit_scan_consecutive_range(unsigned *mask, int *start, int *count)
*mask &= ~(((1u << *count) - 1) << *start);
}
+static inline void
+u_bit_scan_consecutive_range64(uint64_t *mask, int *start, int *count)
+{
+ if (*mask == ~0llu) {
+ *start = 0;
+ *count = 64;
+ *mask = 0;
+ return;
+ }
+ *start = ffsll(*mask) - 1;
+ *count = ffsll(~(*mask >> *start)) - 1;
+ *mask &= ~(((1llu << *count) - 1) << *start);
+}
+
/**
* Return float bits.
*/