From: Sebastian Hack Date: Fri, 27 Jan 2006 17:20:45 +0000 (+0000) Subject: Added flip_all function X-Git-Url: http://nsz.repo.hu/git/?a=commitdiff_plain;h=93a945891ed94899f86039985c94bca3a0209200;p=libfirm Added flip_all function [r7282] --- diff --git a/ir/adt/bitset.h b/ir/adt/bitset.h index d16d44955..ae9d8a485 100644 --- a/ir/adt/bitset.h +++ b/ir/adt/bitset.h @@ -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. diff --git a/ir/adt/bitset_std.h b/ir/adt/bitset_std.h index 49edee217..8d94b2fde 100644 --- a/ir/adt/bitset_std.h +++ b/ir/adt/bitset_std.h @@ -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.