From dd312230a8b2bd294780d451b26976599cec83dd Mon Sep 17 00:00:00 2001 From: Michael Beck Date: Sun, 18 Nov 2007 20:38:54 +0000 Subject: [PATCH] added rbitset_malloc() [r16781] --- include/libfirm/adt/raw_bitset.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/include/libfirm/adt/raw_bitset.h b/include/libfirm/adt/raw_bitset.h index 05ac9e42d..8ffee7a8a 100644 --- a/include/libfirm/adt/raw_bitset.h +++ b/include/libfirm/adt/raw_bitset.h @@ -49,6 +49,21 @@ #define BITSET_SIZE_BYTES(size_bits) (BITSET_SIZE_ELEMS(size_bits)*4) #define BITSET_ELEM(bitset,pos) bitset[pos / 32] +/** + * Allocate an empty raw bitset on the heap. + * + * @param size element size of the bitset + * + * @return the new bitset + */ +static INLINE unsigned *rbitset_malloc(unsigned size) { + unsigned size_bytes = BITSET_SIZE_BYTES(size); + unsigned *res = malloc(size_bytes); + memset(res, 0, size_bytes); + + return res; +} + /** * Allocate an empty raw bitset on the stack. * -- 2.20.1