mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-06 02:58:05 +02:00
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 <bas@basnieuwenhuizen.nl> Reviewed-by: Marek Olšák <marek.olsak@amd.com>
This commit is contained in:
parent
058b54c624
commit
0b6c463dac
1 changed files with 14 additions and 0 deletions
|
|
@ -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.
|
||||
*/
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue