mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-29 14:30:10 +01:00
util: Explain BITSET_FOREACH_SET params
__size, in particular, makes this macro rather confusing to understand how to use. Hopefully this comment saves future users the headache. Reviewed-by: Jason Ekstrand <jason@jlekstrand.net> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3499>
This commit is contained in:
parent
60f9b45802
commit
d3eb2a0951
1 changed files with 8 additions and 0 deletions
|
|
@ -129,6 +129,14 @@ __bitset_next_set(unsigned i, BITSET_WORD *tmp,
|
|||
return word * BITSET_WORDBITS + bit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Iterates over each set bit in a set
|
||||
*
|
||||
* @param __i iteration variable, bit number
|
||||
* @param __tmp an internally-used temporary bitset
|
||||
* @param __set the bitset to iterate (will not be modified)
|
||||
* @param __size number of bits in the set to consider
|
||||
*/
|
||||
#define BITSET_FOREACH_SET(__i, __tmp, __set, __size) \
|
||||
for (__tmp = *(__set), __i = 0; \
|
||||
(__i = __bitset_next_set(__i, &__tmp, __set, __size)) < __size;)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue