mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-06-06 14:58:28 +02:00
util: Use same method to clear bits in u_foreach_bit as util_bitcount
Saves about 2k text size. Before: text data bss dec hex filename 24817485 456164 27080 25300729 1820ef9 ./lib64/libvulkan_intel.so After: text data bss dec hex filename 24815381 456164 27080 25298625 18206c1 ./lib64/libvulkan_intel.so Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40230>
This commit is contained in:
parent
e13565acf4
commit
d038bfa1c1
1 changed files with 7 additions and 5 deletions
|
|
@ -106,10 +106,11 @@ u_bit_scan(unsigned *mask)
|
|||
return i;
|
||||
}
|
||||
|
||||
#define u_foreach_bit(b, dword) \
|
||||
#define u_foreach_bit(b, dword) \
|
||||
for (uint32_t __dword = (dword), b; \
|
||||
((b) = ffs(__dword) - 1, __dword); \
|
||||
__dword &= ~(1 << (b)))
|
||||
((b) = ffs(__dword) - 1, __dword); \
|
||||
/* See util_bitcount below. */ \
|
||||
__dword &= __dword - 1)
|
||||
|
||||
static inline int
|
||||
u_bit_scan64(uint64_t *mask)
|
||||
|
|
@ -121,8 +122,9 @@ u_bit_scan64(uint64_t *mask)
|
|||
|
||||
#define u_foreach_bit64(b, dword) \
|
||||
for (uint64_t __dword = (dword), b; \
|
||||
((b) = ffsll(__dword) - 1, __dword); \
|
||||
__dword &= ~(1ull << (b)))
|
||||
((b) = ffsll(__dword) - 1, __dword); \
|
||||
/* See util_bitcount below. */ \
|
||||
__dword &= __dword - 1)
|
||||
|
||||
/* Given two bitmasks, loop over all bits of both of them.
|
||||
* Bits of mask1 are: b = scan_bit(mask1);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue