From: Michael Beck Date: Sun, 18 Nov 2007 20:38:54 +0000 (+0000) Subject: added rbitset_malloc() X-Git-Url: http://nsz.repo.hu/git/?a=commitdiff_plain;h=dd312230a8b2bd294780d451b26976599cec83dd;p=libfirm added rbitset_malloc() [r16781] --- 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. *