* sbitmap.c (sbitmap_ones): Don't set too many bits.
authorRichard Henderson <rth@gcc.gnu.org>
Mon, 4 Oct 1999 18:39:19 +0000 (11:39 -0700)
committerRichard Henderson <rth@gcc.gnu.org>
Mon, 4 Oct 1999 18:39:19 +0000 (11:39 -0700)
From-SVN: r29807

gcc/sbitmap.c

index 89d6600927d181b44d5ef509cab0655a3e1d7dfb..8aae23aac64005cd29d4ad6d0b5ee83f02aa66d0 100644 (file)
@@ -115,7 +115,16 @@ void
 sbitmap_ones (bmap)
      sbitmap bmap;
 {
+  unsigned int last_bit;
+
   memset (bmap->elms, -1, bmap->bytes);
+
+  last_bit = bmap->n_bits % (unsigned) SBITMAP_ELT_BITS;
+  if (last_bit)
+    {
+      bmap->elms[bmap->size - 1]
+        = (SBITMAP_ELT_TYPE)-1 >> (SBITMAP_ELT_BITS - last_bit);
+    }
 }
 
 /* Zero a vector of N_VECS bitmaps.  */
@@ -208,7 +217,7 @@ sbitmap_difference (dst, a, b)
     *dstp++ = *ap++ & (~*bp++);
 }
 
-/* Set DST to be (A and B)).
+/* Set DST to be (A and B).
    Return non-zero if any change is made.  */
 
 int