diff options
| author | Alyssa Rosenzweig <alyssa.rosenzweig@intel.com> | 2025-11-04 13:41:23 -0500 |
|---|---|---|
| committer | Marge Bot <marge-bot@fdo.invalid> | 2025-11-05 18:44:23 +0000 |
| commit | ab4cff4f5c9ed81b11f455ff65f092d3913a2bba (patch) | |
| tree | a31984cfd6759778762e1ea052d73d797741b04f /src/util | |
| parent | 18eacdda3ec897067f8c80f4fc5f1c14c2d459a0 (diff) | |
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>
Diffstat (limited to 'src/util')
| -rw-r--r-- | src/util/bitset.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/util/bitset.h b/src/util/bitset.h index 601f85ad9f8..7e10b78c2eb 100644 --- a/src/util/bitset.h +++ b/src/util/bitset.h @@ -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 /** |