sbitmap.c (sbitmap_union_of_diff_cg, [...]): Accumulate "changed" properly.

2003-12-28  Mostafa Hagog  <mustafa@il.ibm.com>

	* sbitmap.c (sbitmap_union_of_diff_cg, sbitmap_a_and_b_cg,
	sbitmap_a_xor_b_cg): Accumulate "changed" properly.
	(sbitmap_not): Zero all bits past n_bit.

From-SVN: r75182
This commit is contained in:
Mostafa Hagog 2003-12-28 16:53:27 +00:00 committed by Roger Sayle
parent b8da67fa2f
commit 315d849ab2
2 changed files with 16 additions and 3 deletions

View File

@ -1,3 +1,9 @@
2003-12-28 Mostafa Hagog <mustafa@il.ibm.com>
* sbitmap.c (sbitmap_union_of_diff_cg, sbitmap_a_and_b_cg,
sbitmap_a_xor_b_cg): Accumulate "changed" properly.
(sbitmap_not): Zero all bits past n_bit.
2003-12-27 Zdenek Dvorak <rakdver@atrey.karlin.mff.cuni.cz>
PR opt/13159

View File

@ -250,9 +250,16 @@ sbitmap_not (sbitmap dst, sbitmap src)
unsigned int i, n = dst->size;
sbitmap_ptr dstp = dst->elms;
sbitmap_ptr srcp = src->elms;
unsigned int last_bit;
for (i = 0; i < n; i++)
*dstp++ = ~*srcp++;
/* Zero all bits past n_bits, by ANDing dst with sbitmap_ones. */
last_bit = src->n_bits % SBITMAP_ELT_BITS;
if (last_bit)
dst->elms[n-1] = dst->elms[n-1]
& ((SBITMAP_ELT_TYPE)-1 >> (SBITMAP_ELT_BITS - last_bit));
}
/* Set the bits in DST to be the difference between the bits
@ -298,7 +305,7 @@ sbitmap_a_and_b_cg (sbitmap dst, sbitmap a, sbitmap b)
for (i = 0; i < n; i++)
{
SBITMAP_ELT_TYPE tmp = *ap++ & *bp++;
changed = *dstp ^ tmp;
changed |= *dstp ^ tmp;
*dstp++ = tmp;
}
@ -332,7 +339,7 @@ sbitmap_a_xor_b_cg (sbitmap dst, sbitmap a, sbitmap b)
for (i = 0; i < n; i++)
{
SBITMAP_ELT_TYPE tmp = *ap++ ^ *bp++;
changed = *dstp ^ tmp;
changed |= *dstp ^ tmp;
*dstp++ = tmp;
}
@ -366,7 +373,7 @@ sbitmap_a_or_b_cg (sbitmap dst, sbitmap a, sbitmap b)
for (i = 0; i < n; i++)
{
SBITMAP_ELT_TYPE tmp = *ap++ | *bp++;
changed = *dstp ^ tmp;
changed |= *dstp ^ tmp;
*dstp++ = tmp;
}