mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-02-09 12:00:26 +01:00
util/idalloc: resize if ID is too large for reservation
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7031>
This commit is contained in:
parent
155b1b1792
commit
72fa3372cc
1 changed files with 2 additions and 1 deletions
|
|
@ -103,7 +103,8 @@ util_idalloc_free(struct util_idalloc *buf, unsigned id)
|
|||
void
|
||||
util_idalloc_reserve(struct util_idalloc *buf, unsigned id)
|
||||
{
|
||||
assert(id < buf->num_elements);
|
||||
if (id >= buf->num_elements)
|
||||
util_idalloc_resize(buf, id * 2);
|
||||
assert((buf->data[id / 32] & (1u << (id % 32))) == 0);
|
||||
buf->data[id / 32] |= 1u << (id % 32);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue