mirror of git://gcc.gnu.org/git/gcc.git
sbitmap.h (sbitmap_iter_init): Consistently treat bit_num as the current bit index with no modulo.
* sbitmap.h (sbitmap_iter_init): Consistently treat bit_num as the current bit index with no modulo. From-SVN: r100720
This commit is contained in:
parent
e699ee2475
commit
108267cd56
|
|
@ -1,3 +1,8 @@
|
||||||
|
2005-06-07 Kazu Hirata <kazu@codesourcery.com>
|
||||||
|
|
||||||
|
* sbitmap.h (sbitmap_iter_init): Consistently treat bit_num as
|
||||||
|
the current bit index with no modulo.
|
||||||
|
|
||||||
2005-06-07 Sebastian Pop <pop@cri.ensmp.fr>
|
2005-06-07 Sebastian Pop <pop@cri.ensmp.fr>
|
||||||
|
|
||||||
PR 18403 and meta PR 21861.
|
PR 18403 and meta PR 21861.
|
||||||
|
|
|
||||||
|
|
@ -66,7 +66,7 @@ typedef struct {
|
||||||
/* The current word index. */
|
/* The current word index. */
|
||||||
unsigned int word_num;
|
unsigned int word_num;
|
||||||
|
|
||||||
/* The current bit index. */
|
/* The current bit index (not modulo SBITMAP_ELT_BITS). */
|
||||||
unsigned int bit_num;
|
unsigned int bit_num;
|
||||||
|
|
||||||
/* The words currently visited. */
|
/* The words currently visited. */
|
||||||
|
|
@ -80,14 +80,15 @@ static inline void
|
||||||
sbitmap_iter_init (sbitmap_iterator *i, sbitmap bmp, unsigned int min)
|
sbitmap_iter_init (sbitmap_iterator *i, sbitmap bmp, unsigned int min)
|
||||||
{
|
{
|
||||||
i->word_num = min / (unsigned int) SBITMAP_ELT_BITS;
|
i->word_num = min / (unsigned int) SBITMAP_ELT_BITS;
|
||||||
i->bit_num = min % (unsigned int) SBITMAP_ELT_BITS;
|
i->bit_num = min;
|
||||||
i->size = bmp->size;
|
i->size = bmp->size;
|
||||||
i->ptr = bmp->elms;
|
i->ptr = bmp->elms;
|
||||||
|
|
||||||
if (i->word_num >= i->size)
|
if (i->word_num >= i->size)
|
||||||
i->word = 0;
|
i->word = 0;
|
||||||
else
|
else
|
||||||
i->word = i->ptr[i->word_num] >> i->bit_num;
|
i->word = (i->ptr[i->word_num]
|
||||||
|
>> (i->bit_num % (unsigned int) SBITMAP_ELT_BITS));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Return true if we have more bits to visit, in which case *N is set
|
/* Return true if we have more bits to visit, in which case *N is set
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue