Commit e90ea8cb by Nathan Sidwell Committed by Nathan Sidwell

bitmap.h (bitmap_iterator): Remove word_bit and bit fields.

	* bitmap.h (bitmap_iterator): Remove word_bit and bit
	fields. Rename others.
	(bmp_iter_common_next_1, bmp_iter_single_next_1,
	bmp_iter_single_init, bmp_iter_end_p, bmp_iter_single_next,
	bmp_iter_and_not_next_1, bmp_iter_and_not_init,
	bmp_iter_and_not_next, bmp_iter_and_next_1, bmp_iter_and_init,
	bmp_iter_and_next): Remove.
	(bmp_iter_set_init, bmp_iter_and_init, bmp_iter_and_compl_init,
	bmp_iter_next, bmp_iter_set, bmp_iter_and, bmp_iter_and_compl):
	New.
	(EXECUTE_IF_SET_IN_BITMAP, EXECUTE_IF_AND_IN_BITMAP,
	EXECUTE_IF_AND_COMPL_IN_BITMAP): Adjust.

From-SVN: r90055
parent 67299d91
2004-11-04 Nathan Sidwell <nathan@codesourcery.com> 2004-11-04 Nathan Sidwell <nathan@codesourcery.com>
* bitmap.h (bitmap_iterator): Remove word_bit and bit
fields. Rename others.
(bmp_iter_common_next_1, bmp_iter_single_next_1,
bmp_iter_single_init, bmp_iter_end_p, bmp_iter_single_next,
bmp_iter_and_not_next_1, bmp_iter_and_not_init,
bmp_iter_and_not_next, bmp_iter_and_next_1, bmp_iter_and_init,
bmp_iter_and_next): Remove.
(bmp_iter_set_init, bmp_iter_and_init, bmp_iter_and_compl_init,
bmp_iter_next, bmp_iter_set, bmp_iter_and, bmp_iter_and_compl):
New.
(EXECUTE_IF_SET_IN_BITMAP, EXECUTE_IF_AND_IN_BITMAP,
EXECUTE_IF_AND_COMPL_IN_BITMAP): Adjust.
* bitmap.h (bitmap_a_or_b, bitmap_a_and_b): Remove. * bitmap.h (bitmap_a_or_b, bitmap_a_and_b): Remove.
* df.c (dataflow_set_a_op_b): Use bitmap_and, bitmap_ior, * df.c (dataflow_set_a_op_b): Use bitmap_and, bitmap_ior,
bitmap_and_into, bitmap_ior_into as appropriate. bitmap_and_into, bitmap_ior_into as appropriate.
......
...@@ -184,421 +184,387 @@ do { \ ...@@ -184,421 +184,387 @@ do { \
typedef struct typedef struct
{ {
/* Actual elements in the bitmaps. */ /* Pointer to the current bitmap element. */
bitmap_element *ptr1, *ptr2; bitmap_element *elt1;
/* Position of an actual word in the elements. */ /* Pointer to 2nd bitmap element when two are involved. */
unsigned word; bitmap_element *elt2;
/* Position of a bit corresponding to the start of word. */ /* Word within the current element. */
unsigned word_bit; unsigned word_no;
/* Position of the actual bit. */
unsigned bit;
/* Contents of the actually processed word. When finding next bit /* Contents of the actually processed word. When finding next bit
it is shifted right, so that the actual bit is always the least it is shifted right, so that the actual bit is always the least
significant bit of ACTUAL. */ significant bit of ACTUAL. */
BITMAP_WORD actual; BITMAP_WORD bits;
} bitmap_iterator; } bitmap_iterator;
/* Moves the iterator BI to the first set bit on or after the current /* Initialize a single bitmap iterator. START_BIT is the first bit to
position in bitmap and returns the bit if available. The bit is iterate from. */
found in ACTUAL field only. */
static inline unsigned static inline void
bmp_iter_common_next_1 (bitmap_iterator *bi) bmp_iter_set_init (bitmap_iterator *bi, bitmap map,
unsigned start_bit, unsigned *bit_no)
{ {
while (!(bi->actual & 1)) bi->elt1 = map->first;
bi->elt2 = NULL;
/* Advance elt1 until it is not before the block containing start_bit. */
while (1)
{ {
bi->actual >>= 1; if (!bi->elt1)
bi->bit++; {
bi->elt1 = &bitmap_zero_bits;
break;
}
if (bi->elt1->indx >= start_bit / BITMAP_ELEMENT_ALL_BITS)
break;
bi->elt1 = bi->elt1->next;
} }
return bi->bit; /* We might have gone past the start bit, so reinitialize it. */
if (bi->elt1->indx != start_bit / BITMAP_ELEMENT_ALL_BITS)
start_bit = bi->elt1->indx * BITMAP_ELEMENT_ALL_BITS;
/* Initialize for what is now start_bit. */
bi->word_no = start_bit / BITMAP_WORD_BITS % BITMAP_ELEMENT_WORDS;
bi->bits = bi->elt1->bits[bi->word_no];
bi->bits >>= start_bit % BITMAP_WORD_BITS;
/* If this word is zero, we must make sure we're not pointing at the
first bit, otherwise our incrementing to the next word boundary
will fail. It won't matter if this increment moves us into the
next word. */
start_bit += !bi->bits;
*bit_no = start_bit;
} }
/* Moves the iterator BI to the first set bit on or after the current /* Initialize an iterator to iterate over the intersection of two
position in bitmap and returns the bit if available. */ bitmaps. START_BIT is the bit to commence from. */
static inline unsigned static inline void
bmp_iter_single_next_1 (bitmap_iterator *bi) bmp_iter_and_init (bitmap_iterator *bi, bitmap map1, bitmap map2,
unsigned start_bit, unsigned *bit_no)
{ {
if (bi->actual) bi->elt1 = map1->first;
return bmp_iter_common_next_1 (bi); bi->elt2 = map2->first;
bi->word++;
bi->word_bit += BITMAP_WORD_BITS;
/* Advance elt1 until it is not before the block containing
start_bit. */
while (1) while (1)
{ {
for (; if (!bi->elt1)
bi->word < BITMAP_ELEMENT_WORDS;
bi->word++, bi->word_bit += BITMAP_WORD_BITS)
{ {
bi->actual = bi->ptr1->bits[bi->word]; bi->elt2 = NULL;
if (bi->actual) break;
{
bi->bit = bi->word_bit;
return bmp_iter_common_next_1 (bi);
}
} }
bi->ptr1 = bi->ptr1->next; if (bi->elt1->indx >= start_bit / BITMAP_ELEMENT_ALL_BITS)
if (!bi->ptr1) break;
return 0; bi->elt1 = bi->elt1->next;
bi->word = 0;
bi->word_bit = bi->ptr1->indx * BITMAP_ELEMENT_ALL_BITS;
} }
}
/* Advance elt2 until it is not before elt1. */
/* Initializes a bitmap iterator BI for looping over bits of bitmap while (1)
BMP, starting with bit MIN. Returns the first bit of BMP greater
or equal to MIN if there is any. */
static inline unsigned
bmp_iter_single_init (bitmap_iterator *bi, bitmap bmp, unsigned min)
{
unsigned indx = min / BITMAP_ELEMENT_ALL_BITS;
for (bi->ptr1 = bmp->first;
bi->ptr1 && bi->ptr1->indx < indx;
bi->ptr1 = bi->ptr1->next)
continue;
if (!bi->ptr1)
{ {
/* To avoid warnings. */ if (!bi->elt2)
bi->word = 0; {
bi->bit = 0; bi->elt1 = bi->elt2 = &bitmap_zero_bits;
bi->word_bit = 0; break;
bi->actual = 0; }
bi->ptr2 = NULL;
return 0; if (bi->elt2->indx >= bi->elt1->indx)
break;
bi->elt2 = bi->elt2->next;
} }
if (bi->ptr1->indx == indx) /* If we're at the same index, then we have some intersecting bits. */
if (bi->elt1->indx == bi->elt2->indx)
{ {
unsigned bit_in_elt = min - BITMAP_ELEMENT_ALL_BITS * indx; /* We might have advanced beyond the start_bit, so reinitialize
unsigned word_in_elt = bit_in_elt / BITMAP_WORD_BITS; for that. */
unsigned bit_in_word = bit_in_elt % BITMAP_WORD_BITS; if (bi->elt1->indx != start_bit / BITMAP_ELEMENT_ALL_BITS)
start_bit = bi->elt1->indx * BITMAP_ELEMENT_ALL_BITS;
bi->word = word_in_elt;
bi->word_bit = min - bit_in_word; bi->word_no = start_bit / BITMAP_WORD_BITS % BITMAP_ELEMENT_WORDS;
bi->bit = min; bi->bits = bi->elt1->bits[bi->word_no] & bi->elt2->bits[bi->word_no];
bi->actual = bi->ptr1->bits[word_in_elt] >> bit_in_word; bi->bits >>= start_bit % BITMAP_WORD_BITS;
} }
else else
{ {
bi->word = 0; /* Otherwise we must immediately advance elt1, so initialize for
bi->bit = bi->ptr1->indx * BITMAP_ELEMENT_ALL_BITS; that. */
bi->word_bit = bi->bit; bi->word_no = BITMAP_ELEMENT_WORDS - 1;
bi->actual = bi->ptr1->bits[0]; bi->bits = 0;
} }
return bmp_iter_single_next_1 (bi); /* If this word is zero, we must make sure we're not pointing at the
first bit, otherwise our incrementing to the next word boundary
will fail. It won't matter if this increment moves us into the
next word. */
start_bit += !bi->bits;
*bit_no = start_bit;
} }
/* Returns true if all elements of the bitmap referred to by iterator BI /* Initialize an iterator to iterate over the bits in MAP1 & ~MAP2.
were processed. */ */
static inline bool static inline void
bmp_iter_end_p (const bitmap_iterator *bi) bmp_iter_and_compl_init (bitmap_iterator *bi, bitmap map1, bitmap map2,
unsigned start_bit, unsigned *bit_no)
{ {
return bi->ptr1 == NULL; bi->elt1 = map1->first;
} bi->elt2 = map2->first;
/* Moves the iterator BI to the next bit of bitmap and returns the bit
if available. */
static inline unsigned
bmp_iter_single_next (bitmap_iterator *bi)
{
bi->bit++;
bi->actual >>= 1;
return bmp_iter_single_next_1 (bi);
}
/* Loop over all bits in BITMAP, starting with MIN and setting BITNUM to
the bit number. ITER is a bitmap iterator. */
#define EXECUTE_IF_SET_IN_BITMAP(BITMAP, MIN, BITNUM, ITER) \
for ((BITNUM) = bmp_iter_single_init (&(ITER), (BITMAP), (MIN)); \
!bmp_iter_end_p (&(ITER)); \
(BITNUM) = bmp_iter_single_next (&(ITER)))
/* Moves the iterator BI to the first set bit on or after the current
position in difference of bitmaps and returns the bit if available. */
static inline unsigned
bmp_iter_and_not_next_1 (bitmap_iterator *bi)
{
if (bi->actual)
return bmp_iter_common_next_1 (bi);
bi->word++;
bi->word_bit += BITMAP_WORD_BITS;
/* Advance elt1 until it is not before the block containing start_bit. */
while (1) while (1)
{ {
bitmap_element *snd; if (!bi->elt1)
if (bi->ptr2 && bi->ptr2->indx == bi->ptr1->indx)
snd = bi->ptr2;
else
snd = &bitmap_zero_bits;
for (;
bi->word < BITMAP_ELEMENT_WORDS;
bi->word++, bi->word_bit += BITMAP_WORD_BITS)
{ {
bi->actual = (bi->ptr1->bits[bi->word] bi->elt1 = &bitmap_zero_bits;
& ~snd->bits[bi->word]); break;
if (bi->actual)
{
bi->bit = bi->word_bit;
return bmp_iter_common_next_1 (bi);
}
} }
bi->ptr1 = bi->ptr1->next; if (bi->elt1->indx >= start_bit / BITMAP_ELEMENT_ALL_BITS)
if (!bi->ptr1) break;
return 0; bi->elt1 = bi->elt1->next;
while (bi->ptr2
&& bi->ptr2->indx < bi->ptr1->indx)
bi->ptr2 = bi->ptr2->next;
bi->word = 0;
bi->word_bit = bi->ptr1->indx * BITMAP_ELEMENT_ALL_BITS;
} }
/* Advance elt2 until it is not before elt1. */
while (bi->elt2 && bi->elt2->indx < bi->elt1->indx)
bi->elt2 = bi->elt2->next;
/* We might have advanced beyond the start_bit, so reinitialize for
that. */
if (bi->elt1->indx != start_bit / BITMAP_ELEMENT_ALL_BITS)
start_bit = bi->elt1->indx * BITMAP_ELEMENT_ALL_BITS;
bi->word_no = start_bit / BITMAP_WORD_BITS % BITMAP_ELEMENT_WORDS;
bi->bits = bi->elt1->bits[bi->word_no];
if (bi->elt2 && bi->elt1->indx == bi->elt2->indx)
bi->bits &= ~bi->elt2->bits[bi->word_no];
bi->bits >>= start_bit % BITMAP_WORD_BITS;
/* If this word is zero, we must make sure we're not pointing at the
first bit, otherwise our incrementing to the next word boundary
will fail. It won't matter if this increment moves us into the
next word. */
start_bit += !bi->bits;
*bit_no = start_bit;
} }
/* Initializes a bitmap iterator BI for looping over bits of bitmap /* Advance to the next bit in BI. We don't advance to the next
BMP1 &~ BMP2, starting with bit MIN. Returns the first bit of non-zero bit yet. */
BMP1 &~ BMP2 greater or equal to MIN if there is any. */
static inline unsigned static inline void
bmp_iter_and_not_init (bitmap_iterator *bi, bitmap bmp1, bitmap bmp2, bmp_iter_next (bitmap_iterator *bi, unsigned *bit_no)
unsigned min)
{ {
unsigned indx = min / BITMAP_ELEMENT_ALL_BITS; bi->bits >>= 1;
*bit_no += 1;
}
for (bi->ptr1 = bmp1->first; /* Advance to the next non-zero bit of a single bitmap, we will have
bi->ptr1 && bi->ptr1->indx < indx; already advanced past the just iterated bit. Return true if there
bi->ptr1 = bi->ptr1->next) is a bit to iterate. */
continue;
if (!bi->ptr1) static inline bool
bmp_iter_set (bitmap_iterator *bi, unsigned *bit_no)
{
/* If our current word is non-zero, it contains the bit we want. */
if (bi->bits)
{ {
/* To avoid warnings. */ next_bit:
bi->word = 0; while (!(bi->bits & 1))
bi->bit = 0; {
bi->word_bit = 0; bi->bits >>= 1;
bi->actual = 0; *bit_no += 1;
bi->ptr2 = NULL; }
return 0; return true;
} }
for (bi->ptr2 = bmp2->first; /* Round up to the word boundary. We might have just iterated past
bi->ptr2 && bi->ptr2->indx < bi->ptr1->indx; the end of the last word, hence the -1. It is not possible for
bi->ptr2 = bi->ptr2->next) bit_no to point at the beginning of the now last word. */
continue; *bit_no = ((*bit_no + BITMAP_WORD_BITS - 1)
/ BITMAP_WORD_BITS * BITMAP_WORD_BITS);
bi->word_no++;
if (bi->ptr1->indx == indx) while (1)
{
unsigned bit_in_elt = min - BITMAP_ELEMENT_ALL_BITS * indx;
unsigned word_in_elt = bit_in_elt / BITMAP_WORD_BITS;
unsigned bit_in_word = bit_in_elt % BITMAP_WORD_BITS;
bi->word = word_in_elt;
bi->word_bit = min - bit_in_word;
bi->bit = min;
if (bi->ptr2 && bi->ptr2->indx == indx)
bi->actual = (bi->ptr1->bits[word_in_elt]
& ~bi->ptr2->bits[word_in_elt]) >> bit_in_word;
else
bi->actual = bi->ptr1->bits[word_in_elt] >> bit_in_word;
}
else
{ {
bi->word = 0; /* Find the next non-zero word in this elt. */
bi->bit = bi->ptr1->indx * BITMAP_ELEMENT_ALL_BITS; while (bi->word_no != BITMAP_ELEMENT_WORDS)
bi->word_bit = bi->bit; {
bi->bits = bi->elt1->bits[bi->word_no];
if (bi->ptr2 && bi->ptr2->indx == bi->ptr1->indx) if (bi->bits)
bi->actual = (bi->ptr1->bits[0] & ~bi->ptr2->bits[0]); goto next_bit;
else *bit_no += BITMAP_WORD_BITS;
bi->actual = bi->ptr1->bits[0]; bi->word_no++;
}
/* Advance to the next element. */
bi->elt1 = bi->elt1->next;
if (!bi->elt1)
return false;
*bit_no = bi->elt1->indx * BITMAP_ELEMENT_ALL_BITS;
bi->word_no = 0;
} }
return bmp_iter_and_not_next_1 (bi);
}
/* Moves the iterator BI to the next bit of difference of bitmaps and returns
the bit if available. */
static inline unsigned
bmp_iter_and_not_next (bitmap_iterator *bi)
{
bi->bit++;
bi->actual >>= 1;
return bmp_iter_and_not_next_1 (bi);
} }
/* Loop over all bits in BMP1 and BMP2, starting with MIN, setting /* Advance to the next non-zero bit of an intersecting pair of
BITNUM to the bit number for all bits that are set in the first bitmap bitmaps. We will have alreadt advanced past the just iterated bit.
and not set in the second. ITER is a bitmap iterator. */ Return true if there is a bit to iterate. */
#define EXECUTE_IF_AND_COMPL_IN_BITMAP(BMP1, BMP2, MIN, BITNUM, ITER) \ static inline bool
for ((BITNUM) = bmp_iter_and_not_init (&(ITER), (BMP1), (BMP2), (MIN)); \ bmp_iter_and (bitmap_iterator *bi, unsigned *bit_no)
!bmp_iter_end_p (&(ITER)); \
(BITNUM) = bmp_iter_and_not_next (&(ITER)))
/* Moves the iterator BI to the first set bit on or after the current
position in intersection of bitmaps and returns the bit if available. */
static inline unsigned
bmp_iter_and_next_1 (bitmap_iterator *bi)
{ {
if (bi->actual) /* If our current word is non-zero, it contains the bit we want. */
return bmp_iter_common_next_1 (bi); if (bi->bits)
{
bi->word++; next_bit:
bi->word_bit += BITMAP_WORD_BITS; while (!(bi->bits & 1))
{
bi->bits >>= 1;
*bit_no += 1;
}
return true;
}
/* Round up to the word boundary. We might have just iterated past
the end of the last word, hence the -1. It is not possible for
bit_no to point at the beginning of the now last word. */
*bit_no = ((*bit_no + BITMAP_WORD_BITS - 1)
/ BITMAP_WORD_BITS * BITMAP_WORD_BITS);
bi->word_no++;
while (1) while (1)
{ {
for (; /* Find the next non-zero word in this elt. */
bi->word < BITMAP_ELEMENT_WORDS; while (bi->word_no != BITMAP_ELEMENT_WORDS)
bi->word++, bi->word_bit += BITMAP_WORD_BITS)
{ {
bi->actual = (bi->ptr1->bits[bi->word] bi->bits = bi->elt1->bits[bi->word_no] & bi->elt2->bits[bi->word_no];
& bi->ptr2->bits[bi->word]); if (bi->bits)
if (bi->actual) goto next_bit;
{ *bit_no += BITMAP_WORD_BITS;
bi->bit = bi->word_bit; bi->word_no++;
return bmp_iter_common_next_1 (bi);
}
} }
/* Advance to the next identical element. */
do do
{ {
bi->ptr1 = bi->ptr1->next; /* Advance elt1 while it is less than elt2. We always want
if (!bi->ptr1) to advance one elt. */
return 0; do
while (bi->ptr2->indx < bi->ptr1->indx)
{ {
bi->ptr2 = bi->ptr2->next; bi->elt1 = bi->elt1->next;
if (!bi->ptr2) if (!bi->elt1)
{ return false;
bi->ptr1 = NULL; }
return 0; while (bi->elt1->indx < bi->elt2->indx);
}
/* Advance elt2 to be no less than elt1. This might not
advance. */
while (bi->elt2->indx < bi->elt1->indx)
{
bi->elt2 = bi->elt2->next;
if (!bi->elt2)
return false;
} }
} }
while (bi->ptr1->indx != bi->ptr2->indx); while (bi->elt1->indx != bi->elt2->indx);
bi->word = 0; *bit_no = bi->elt1->indx * BITMAP_ELEMENT_ALL_BITS;
bi->word_bit = bi->ptr1->indx * BITMAP_ELEMENT_ALL_BITS; bi->word_no = 0;
} }
} }
/* Initializes a bitmap iterator BI for looping over bits of bitmap /* Advance to the next non-zero bit in the intersection of
BMP1 & BMP2, starting with bit MIN. Returns the first bit of complemented bitmaps. We will have already advanced past the just
BMP1 & BMP2 greater or equal to MIN if there is any. */ iterated bit. */
static inline unsigned static inline bool
bmp_iter_and_init (bitmap_iterator *bi, bitmap bmp1, bitmap bmp2, bmp_iter_and_compl (bitmap_iterator *bi, unsigned *bit_no)
unsigned min)
{ {
unsigned indx = min / BITMAP_ELEMENT_ALL_BITS; /* If our current word is non-zero, it contains the bit we want. */
if (bi->bits)
for (bi->ptr1 = bmp1->first;
bi->ptr1 && bi->ptr1->indx < indx;
bi->ptr1 = bi->ptr1->next)
continue;
if (!bi->ptr1)
goto empty;
bi->ptr2 = bmp2->first;
if (!bi->ptr2)
goto empty;
while (1)
{ {
while (bi->ptr2->indx < bi->ptr1->indx) next_bit:
while (!(bi->bits & 1))
{ {
bi->ptr2 = bi->ptr2->next; bi->bits >>= 1;
if (!bi->ptr2) *bit_no += 1;
goto empty;
} }
return true;
if (bi->ptr1->indx == bi->ptr2->indx)
break;
bi->ptr1 = bi->ptr1->next;
if (!bi->ptr1)
goto empty;
} }
if (bi->ptr1->indx == indx) /* Round up to the word boundary. We might have just iterated past
{ the end of the last word, hence the -1. It is not possible for
unsigned bit_in_elt = min - BITMAP_ELEMENT_ALL_BITS * indx; bit_no to point at the beginning of the now last word. */
unsigned word_in_elt = bit_in_elt / BITMAP_WORD_BITS; *bit_no = ((*bit_no + BITMAP_WORD_BITS - 1)
unsigned bit_in_word = bit_in_elt % BITMAP_WORD_BITS; / BITMAP_WORD_BITS * BITMAP_WORD_BITS);
bi->word_no++;
bi->word = word_in_elt;
bi->word_bit = min - bit_in_word;
bi->bit = min;
bi->actual = (bi->ptr1->bits[word_in_elt] while (1)
& bi->ptr2->bits[word_in_elt]) >> bit_in_word;
}
else
{ {
bi->word = 0; /* Find the next non-zero word in this elt. */
bi->bit = bi->ptr1->indx * BITMAP_ELEMENT_ALL_BITS; while (bi->word_no != BITMAP_ELEMENT_WORDS)
bi->word_bit = bi->bit; {
bi->bits = bi->elt1->bits[bi->word_no];
bi->actual = (bi->ptr1->bits[0] & bi->ptr2->bits[0]); if (bi->elt2 && bi->elt2->indx == bi->elt1->indx)
bi->bits &= ~bi->elt2->bits[bi->word_no];
if (bi->bits)
goto next_bit;
*bit_no += BITMAP_WORD_BITS;
bi->word_no++;
}
/* Advance to the next element of elt1. */
bi->elt1 = bi->elt1->next;
if (!bi->elt1)
return false;
/* Advance elt2 until it is no less than elt1. */
while (bi->elt2 && bi->elt2->indx < bi->elt1->indx)
bi->elt2 = bi->elt2->next;
*bit_no = bi->elt1->indx * BITMAP_ELEMENT_ALL_BITS;
bi->word_no = 0;
} }
return bmp_iter_and_next_1 (bi);
empty:
/* To avoid warnings. */
bi->word = 0;
bi->bit = 0;
bi->word_bit = 0;
bi->actual = 0;
bi->ptr1 = NULL;
bi->ptr2 = NULL;
return 0;
}
/* Moves the iterator BI to the next bit of intersection of bitmaps and returns
the bit if available. */
static inline unsigned
bmp_iter_and_next (bitmap_iterator *bi)
{
bi->bit++;
bi->actual >>= 1;
return bmp_iter_and_next_1 (bi);
} }
/* Loop over all bits in BMP1 and BMP2, starting with MIN, setting /* Loop over all bits set in BITMAP, starting with MIN and setting
BITNUM to the bit number for all bits that are set in both bitmaps. BITNUM to the bit number. ITER is a bitmap iterator. BITNUM
ITER is a bitmap iterator. */ should be treated as a read-only variable as it contains loop
state. */
#define EXECUTE_IF_AND_IN_BITMAP(BMP1, BMP2, MIN, BITNUM, ITER) \ #define EXECUTE_IF_SET_IN_BITMAP(BITMAP, MIN, BITNUM, ITER) \
for ((BITNUM) = bmp_iter_and_init (&(ITER), (BMP1), (BMP2), (MIN)); \ for (bmp_iter_set_init (&(ITER), (BITMAP), (MIN), &(BITNUM)); \
!bmp_iter_end_p (&(ITER)); \ bmp_iter_set (&(ITER), &(BITNUM)); \
(BITNUM) = bmp_iter_and_next (&(ITER))) bmp_iter_next (&(ITER), &(BITNUM)))
/* Loop over all the bits set in BITMAP1 & BITMAP2, starting with MIN
and setting BITNUM to the bit number. ITER is a bitmap iterator.
BITNUM should be treated as a read-only variable as it contains
loop state. */
#define EXECUTE_IF_AND_IN_BITMAP(BITMAP1, BITMAP2, MIN, BITNUM, ITER) \
for (bmp_iter_and_init (&(ITER), (BITMAP1), (BITMAP2), (MIN), \
&(BITNUM)); \
bmp_iter_and (&(ITER), &(BITNUM)); \
bmp_iter_next (&(ITER), &(BITNUM)))
/* Loop over all the bits set in BITMAP1 & ~BITMAP2, starting with MIN
and setting BITNUM to the bit number. ITER is a bitmap iterator.
BITNUM should be treated as a read-only variable as it contains
loop state. */
#define EXECUTE_IF_AND_COMPL_IN_BITMAP(BITMAP1, BITMAP2, MIN, BITNUM, ITER) \
for (bmp_iter_and_compl_init (&(ITER), (BITMAP1), (BITMAP2), (MIN), \
&(BITNUM)); \
bmp_iter_and_compl (&(ITER), &(BITNUM)); \
bmp_iter_next (&(ITER), &(BITNUM)))
#endif /* GCC_BITMAP_H */ #endif /* GCC_BITMAP_H */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment