Bugfix in mask highest.
authorDaniel Grund <grund@cs.uni-saarland.de>
Wed, 10 Aug 2005 13:06:23 +0000 (13:06 +0000)
committerDaniel Grund <grund@cs.uni-saarland.de>
Wed, 10 Aug 2005 13:06:23 +0000 (13:06 +0000)
[r6387]

ir/adt/bitset.h

index 4f249be..d16d449 100644 (file)
@@ -73,8 +73,10 @@ static INLINE bitset_t *_bitset_prepare(void *area, bitset_pos_t size)
  */
 static INLINE bitset_t *_bitset_mask_highest(bitset_t *bs)
 {
-  bs->data[bs->units - 1] &= (1 << (bs->size & BS_UNIT_MASK)) - 1;
-  return bs;
+       bitset_pos_t rest = bs->size & BS_UNIT_MASK;
+       if (rest)
+               bs->data[bs->units - 1] &= (1 << rest) - 1;
+       return bs;
 }
 
 /**