About Social Code
aboutsummaryrefslogtreecommitdiff
path: root/src/util/bitset.h
diff options
context:
space:
mode:
authorMarek Olšák <marek.olsak@amd.com>2024-11-30 08:00:53 -0500
committerMarge Bot <emma+marge@anholt.net>2024-12-04 13:40:41 +0000
commit16f7d22394a6ed34c64cb855e4e0d9f9ae5f7465 (patch)
tree5586c063d29ab143951ba72cd691567e156e817c /src/util/bitset.h
parentda3f9e36267873fa3f54a5bee1f9c293c47088ee (diff)
util/bitset: add BITSET_GET_RANGE_INSIDE_WORD
to be used later Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32424>
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)) : \