summaryrefslogtreecommitdiff
path: root/gcc/sbitmap.h
diff options
context:
space:
mode:
authorkazu <kazu@138bc75d-0d04-0410-961f-82ee72b054a4>2004-10-18 23:56:18 +0000
committerkazu <kazu@138bc75d-0d04-0410-961f-82ee72b054a4>2004-10-18 23:56:18 +0000
commit29718e88ea7b160d8d1b8a7d3596bc8a29d450a3 (patch)
treedf439e236caf978e52207ade9766b30f9adaddab /gcc/sbitmap.h
parent40290b326599b2d9ff1d632c8757020701a713a3 (diff)
downloadgcc-29718e88ea7b160d8d1b8a7d3596bc8a29d450a3.tar.gz
* sbitmap.h (EXECUTE_IF_SET_IN_SBITMAP): Speed up by shifting
the currently visited word to right. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@89259 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/sbitmap.h')
-rw-r--r--gcc/sbitmap.h32
1 files changed, 13 insertions, 19 deletions
diff --git a/gcc/sbitmap.h b/gcc/sbitmap.h
index c18b3762b4a..e75e3b66df3 100644
--- a/gcc/sbitmap.h
+++ b/gcc/sbitmap.h
@@ -58,30 +58,24 @@ typedef SBITMAP_ELT_TYPE *sbitmap_ptr;
/* Loop over all elements of SBITSET, starting with MIN. */
#define EXECUTE_IF_SET_IN_SBITMAP(SBITMAP, MIN, N, CODE) \
do { \
- unsigned int word_num_; \
+ unsigned int word_num_ = (MIN) / (unsigned int) SBITMAP_ELT_BITS; \
unsigned int bit_num_ = (MIN) % (unsigned int) SBITMAP_ELT_BITS; \
unsigned int size_ = (SBITMAP)->size; \
SBITMAP_ELT_TYPE *ptr_ = (SBITMAP)->elms; \
+ SBITMAP_ELT_TYPE word_ = ptr_[word_num_] >> bit_num_; \
\
- for (word_num_ = (MIN) / (unsigned int) SBITMAP_ELT_BITS; \
- word_num_ < size_; word_num_++, bit_num_ = 0) \
+ for (; \
+ word_num_ < size_; \
+ word_num_++, bit_num_ = 0, word_ = ptr_[word_num_]) \
{ \
- SBITMAP_ELT_TYPE word_ = ptr_[word_num_]; \
- \
- if (word_ != 0) \
- for (; bit_num_ < SBITMAP_ELT_BITS; bit_num_++) \
- { \
- SBITMAP_ELT_TYPE _mask = (SBITMAP_ELT_TYPE) 1 << bit_num_; \
- \
- if ((word_ & _mask) != 0) \
- { \
- word_ &= ~ _mask; \
- (N) = word_num_ * SBITMAP_ELT_BITS + bit_num_; \
- CODE; \
- if (word_ == 0) \
- break; \
- } \
- } \
+ for (; word_ != 0; word_ >>= 1, bit_num_++) \
+ { \
+ if ((word_ & 1) != 0) \
+ { \
+ (N) = word_num_ * SBITMAP_ELT_BITS + bit_num_; \
+ CODE; \
+ } \
+ } \
} \
} while (0)