Commit dd312230 authored by Michael Beck's avatar Michael Beck
Browse files

added rbitset_malloc()

[r16781]
parent 1535324d
......@@ -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.
*
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment