About Social Code
aboutsummaryrefslogtreecommitdiff
path: root/src/util/bitset.h
diff options
context:
space:
mode:
authorMarek Olšák <marek.olsak@amd.com>2023-11-26 09:23:10 -0500
committerMarge Bot <emma+marge@anholt.net>2023-12-09 00:05:27 +0000
commitfb994f44d91a4b94738ea4ebb83aab1a257ef123 (patch)
treef318a7002b5c1ed4f367d3ed69ba137d9c666faf /src/util/bitset.h
parent6d2a7f53acfb219910fde175a4233bd5157937f0 (diff)
util: make BITSET_TEST_RANGE_INSIDE_WORD take a value to compare with
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26307>
Diffstat (limited to 'src/util/bitset.h')
-rw-r--r--src/util/bitset.h8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/util/bitset.h b/src/util/bitset.h
index d5b5d6dae2d..cffbb73ecce 100644
--- a/src/util/bitset.h
+++ b/src/util/bitset.h
@@ -205,11 +205,11 @@ __bitset_shl(BITSET_WORD *x, unsigned amount, unsigned n)
#define BITSET_SHL(x, n) \
__bitset_shl(x, n, ARRAY_SIZE(x));
-/* bit range operations
+/* bit range operations (e=end is inclusive)
*/
-#define BITSET_TEST_RANGE_INSIDE_WORD(x, b, e) \
+#define BITSET_TEST_RANGE_INSIDE_WORD(x, b, e, mask) \
(BITSET_BITWORD(b) == BITSET_BITWORD(e) ? \
- (((x)[BITSET_BITWORD(b)] & BITSET_RANGE(b, e)) != 0) : \
+ (((x)[BITSET_BITWORD(b)] & BITSET_RANGE(b, e)) == mask) : \
(assert (!"BITSET_TEST_RANGE: bit range crosses word boundary"), 0))
#define BITSET_SET_RANGE_INSIDE_WORD(x, b, e) \
(BITSET_BITWORD(b) == BITSET_BITWORD(e) ? \
@@ -227,7 +227,7 @@ __bitset_test_range(const BITSET_WORD *r, unsigned start, unsigned end)
const unsigned start_mod = start % BITSET_WORDBITS;
if (start_mod + size <= BITSET_WORDBITS) {
- return BITSET_TEST_RANGE_INSIDE_WORD(r, start, end);
+ return !BITSET_TEST_RANGE_INSIDE_WORD(r, start, end, 0);
} else {
const unsigned first_size = BITSET_WORDBITS - start_mod;