util: add BITSET_RZALLOC

to complement BITSET_CALLOC for when you want a memctx in there.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@intel.com>
Reviewed-by: Yonggang Luo <luoyonggang@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38245>
This commit is contained in:
Alyssa Rosenzweig 2025-11-04 13:41:23 -05:00 committed by Marge Bot
parent 18eacdda3e
commit ab4cff4f5c

View file

@ -34,6 +34,7 @@
#include <stdlib.h>
#include "util/bitscan.h"
#include "util/macros.h"
#include "ralloc.h"
/****************************************************************************
* generic bitset implementation
@ -495,6 +496,12 @@ BITSET_CALLOC(unsigned size)
return (BITSET_WORD *) calloc(BITSET_WORDS(size), sizeof(BITSET_WORD));
}
static inline BITSET_WORD *
BITSET_RZALLOC(const void *memctx, unsigned size)
{
return (BITSET_WORD *)rzalloc_size(memctx, BITSET_BYTES(size));
}
#ifdef __cplusplus
/**