mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-04-23 07:20:37 +02:00
util/idalloc: add util_idalloc_reserve
Can be used to mark an id as used (if it was reclaimed without using util_idalloc_alloc). Reviewed-by: Marek Olšák <marek.olsak@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6600>
This commit is contained in:
parent
87ef970ee6
commit
e808d38299
2 changed files with 11 additions and 0 deletions
|
|
@ -94,3 +94,11 @@ util_idalloc_free(struct util_idalloc *buf, unsigned id)
|
|||
assert(id < buf->num_elements);
|
||||
buf->data[id / 32] &= ~(1 << (id % 32));
|
||||
}
|
||||
|
||||
void
|
||||
util_idalloc_reserve(struct util_idalloc *buf, unsigned id)
|
||||
{
|
||||
assert(id < buf->num_elements);
|
||||
assert((buf->data[id / 32] & (1u << (id % 32))) == 0);
|
||||
buf->data[id / 32] |= 1u << (id % 32);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -55,6 +55,9 @@ util_idalloc_alloc(struct util_idalloc *buf);
|
|||
void
|
||||
util_idalloc_free(struct util_idalloc *buf, unsigned id);
|
||||
|
||||
void
|
||||
util_idalloc_reserve(struct util_idalloc *buf, unsigned id);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue