Commit 93a94589 authored by Sebastian Hack's avatar Sebastian Hack
Browse files

Added flip_all function

[r7282]
parent fbd599cd
......@@ -92,7 +92,7 @@ static INLINE bitset_t *_bitset_mask_highest(bitset_t *bs)
* @param bs The bitset.
* @return The highest bit which can be set or cleared plus 1.
*/
#define bistet_size(bs) ((bs)->size)
#define bitset_size(bs) ((bs)->size)
/**
* Allocate a bitset on an obstack.
......@@ -185,6 +185,18 @@ static INLINE void bitset_flip(bitset_t *bs, bitset_pos_t bit)
_bitset_inside_flip(unit, bit & BS_UNIT_MASK);
}
/**
* Flip the whole bitset.
* @param bs The bitset.
*/
static INLINE void bitset_flip_all(bitset_t *bs)
{
bitset_pos_t i;
for(i = 0; i < bs->units; i++)
_bitset_inside_flip_unit(&bs->data[i]);
_bitset_mask_highest(bs);
}
/**
* Copy a bitset to another.
* @param tgt The target bitset.
......
......@@ -64,6 +64,12 @@ typedef unsigned int bitset_unit_t;
*/
#define _bitset_inside_flip(unit_ptr,bit) (*unit_ptr) ^= ~(1 << (bit))
/**
* Flip a whole unit.
* @param unit_ptr The pointer to the unit.
*/
#define _bitset_inside_flip_unit(unit_ptr) (*unit_ptr) = ~(*unit_ptr)
/**
* Count the number of leading zeroes in a unit.
* @param unit A pointer to the unit.
......
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