aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatt Turner <[email protected]>2020-01-21 14:48:04 -0800
committerMarge Bot <[email protected]>2020-01-23 01:52:42 +0000
commitd3eb2a0951ede3c7dcce891c3a153f3ebbb59bae (patch)
treefcb9b571336dce457ef3b04e9586419269a13000
parent60f9b45802ca6f6f0c11dcbf1a056b7291c8adc9 (diff)
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 <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3499>
-rw-r--r--src/util/bitset.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/util/bitset.h b/src/util/bitset.h
index 7f116214b92..f58d9f214e6 100644
--- a/src/util/bitset.h
+++ b/src/util/bitset.h
@@ -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;)