About Social Code
aboutsummaryrefslogtreecommitdiff
path: root/src/util/bitset.h
diff options
context:
space:
mode:
authorAlyssa Rosenzweig <alyssa.rosenzweig@intel.com>2025-10-08 17:37:12 -0400
committerMarge Bot <marge-bot@fdo.invalid>2025-10-09 12:29:55 +0000
commit85207a4f6a87650bd62dae5a0e41b7dc75a15ca9 (patch)
tree22a3ec95d4a8759089fabf9432fa79c58d84712e /src/util/bitset.h
parent3d444619e03532e3666f9ab98ec04a6e3c85f547 (diff)
util: add BITSET_CALLOC helper
comes up a bunch. Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@intel.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37779>
Diffstat (limited to 'src/util/bitset.h')
-rw-r--r--src/util/bitset.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/util/bitset.h b/src/util/bitset.h
index 03e006c43f1..450facef29d 100644
--- a/src/util/bitset.h
+++ b/src/util/bitset.h
@@ -31,6 +31,7 @@
#ifndef BITSET_H
#define BITSET_H
+#include <stdlib.h>
#include "util/bitscan.h"
#include "util/macros.h"
@@ -487,6 +488,11 @@ __bitset_next_range(unsigned *start, unsigned *end, const BITSET_WORD *set,
__start < __size; \
__bitset_next_range(&__start, &__end, __set, __size))
+static inline BITSET_WORD *
+BITSET_CALLOC(unsigned size)
+{
+ return (BITSET_WORD *) calloc(BITSET_WORDS(size), sizeof(BITSET_WORD));
+}
#ifdef __cplusplus