Added flip_all function
authorSebastian Hack <hack@ipd.info.uni-karlsruhe.de>
Fri, 27 Jan 2006 17:20:45 +0000 (17:20 +0000)
committerSebastian Hack <hack@ipd.info.uni-karlsruhe.de>
Fri, 27 Jan 2006 17:20:45 +0000 (17:20 +0000)
[r7282]

ir/adt/bitset.h
ir/adt/bitset_std.h

index d16d449..ae9d8a4 100644 (file)
@@ -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.
index 49edee2..8d94b2f 100644 (file)
@@ -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.