util/idalloc: Minor refactor of util_idalloc_foreach()
Changes the `for` loop code to be similar to `util_idalloc_forach_no_zero_safe()` for cohesion. Signed-off-by: Karmjit Mahil <karmjit.mahil@igalia.com> Reviewed-by: Marek Olšák <marek.olsak@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32546>
This commit is contained in:
@@ -70,8 +70,8 @@ void
|
||||
util_idalloc_reserve(struct util_idalloc *buf, unsigned id);
|
||||
|
||||
#define util_idalloc_foreach(buf, id) \
|
||||
for (uint32_t _i = 0, _mask = (buf)->num_set_elements ? (buf)->data[0] : 0, id, \
|
||||
_count = (buf)->num_set_elements; \
|
||||
for (uint32_t _i = 0, id, _count = (buf)->num_set_elements, \
|
||||
_mask = _count ? (buf)->data[0] : 0; \
|
||||
_i < _count; _mask = ++_i < _count ? (buf)->data[_i] : 0) \
|
||||
while (_mask) \
|
||||
if ((id = _i * 32 + u_bit_scan(&_mask)), true)
|
||||
|
Reference in New Issue
Block a user