About Social Code
aboutsummaryrefslogtreecommitdiff
path: root/src/util/bitset.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/util/bitset.h')
-rw-r--r--src/util/bitset.h8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/util/bitset.h b/src/util/bitset.h
index 8f6979881bd..4fc4dbb6f3e 100644
--- a/src/util/bitset.h
+++ b/src/util/bitset.h
@@ -207,11 +207,13 @@ __bitset_shl(BITSET_WORD *x, unsigned amount, unsigned n)
/* bit range operations (e=end is inclusive)
*/
-#define BITSET_TEST_RANGE_INSIDE_WORD(x, b, e, mask) \
+#define BITSET_GET_RANGE_INSIDE_WORD(x, b, e) \
(BITSET_BITWORD(b) == BITSET_BITWORD(e) ? \
- (((x)[BITSET_BITWORD(b)] & BITSET_RANGE(b, e)) == \
- (((BITSET_WORD)mask) << (b % BITSET_WORDBITS))) : \
+ (((x)[BITSET_BITWORD(b)] >> (b % BITSET_WORDBITS)) & \
+ BITSET_MASK((e) - (b) + 1)) : \
(assert (!"BITSET_TEST_RANGE: bit range crosses word boundary"), 0))
+#define BITSET_TEST_RANGE_INSIDE_WORD(x, b, e, mask) \
+ (BITSET_GET_RANGE_INSIDE_WORD(x, b, e) == (mask))
#define BITSET_SET_RANGE_INSIDE_WORD(x, b, e) \
(BITSET_BITWORD(b) == BITSET_BITWORD(e) ? \
((x)[BITSET_BITWORD(b)] |= BITSET_RANGE(b, e)) : \