diff options
| author | Christian Gmeiner <christian.gmeiner@gmail.com> | 2021-08-20 12:14:02 +0200 |
|---|---|---|
| committer | Marge Bot <eric+marge@anholt.net> | 2021-09-21 20:25:31 +0000 |
| commit | 3d65cea6ee56c2192d333632bf28460d2857af0a (patch) | |
| tree | 7cbb84398321966f9bc287e46f8316f5736dfa70 /src/util | |
| parent | 3d3a4b9b01cd9baa316308c2bb38a3775c35eceb (diff) | |
util/bitset: s/BITSET_SET_RANGE/BITSET_SET_RANGE_INSIDE_WORD
Prep work for the next commit.
Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Reviewed-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11321>
Diffstat (limited to 'src/util')
| -rw-r--r-- | src/util/bitset.h | 4 | ||||
| -rw-r--r-- | src/util/bitset_test.cpp | 20 |
2 files changed, 12 insertions, 12 deletions
diff --git a/src/util/bitset.h b/src/util/bitset.h index 88c3673a35b..f0b16ea9964 100644 --- a/src/util/bitset.h +++ b/src/util/bitset.h @@ -196,10 +196,10 @@ __bitset_shl(BITSET_WORD *x, unsigned amount, unsigned n) (BITSET_BITWORD(b) == BITSET_BITWORD(e) ? \ (((x)[BITSET_BITWORD(b)] & BITSET_RANGE(b, e)) != 0) : \ (assert (!"BITSET_TEST_RANGE: bit range crosses word boundary"), 0)) -#define BITSET_SET_RANGE(x, b, e) \ +#define BITSET_SET_RANGE_INSIDE_WORD(x, b, e) \ (BITSET_BITWORD(b) == BITSET_BITWORD(e) ? \ ((x)[BITSET_BITWORD(b)] |= BITSET_RANGE(b, e)) : \ - (assert (!"BITSET_SET_RANGE: bit range crosses word boundary"), 0)) + (assert (!"BITSET_SET_RANGE_INSIDE_WORD: bit range crosses word boundary"), 0)) #define BITSET_CLEAR_RANGE(x, b, e) \ (BITSET_BITWORD(b) == BITSET_BITWORD(e) ? \ ((x)[BITSET_BITWORD(b)] &= ~BITSET_RANGE(b, e)) : \ diff --git a/src/util/bitset_test.cpp b/src/util/bitset_test.cpp index 34798f4a77a..608251ec479 100644 --- a/src/util/bitset_test.cpp +++ b/src/util/bitset_test.cpp @@ -73,7 +73,7 @@ TEST(bitset, test_basic_range) BITSET_ZERO(mask128); const int max_set = 15; - BITSET_SET_RANGE(mask128, 0, max_set); + BITSET_SET_RANGE_INSIDE_WORD(mask128, 0, max_set); EXPECT_EQ(BITSET_TEST_RANGE(mask128, 0, max_set), true); EXPECT_EQ(BITSET_TEST_RANGE(mask128, max_set + 1, max_set + 15), false); for (int i = 0; i < 128; i++) { @@ -105,7 +105,7 @@ TEST(bitset, test_bitset_ffs) BITSET_CLEAR(mask128, 14); EXPECT_EQ(BITSET_FFS(mask128), 29); - BITSET_SET_RANGE(mask128, 14, 18); + BITSET_SET_RANGE_INSIDE_WORD(mask128, 14, 18); EXPECT_EQ(BITSET_FFS(mask128), 15); } @@ -114,10 +114,10 @@ TEST(bitset, test_range_bits) BITSET_DECLARE(mask128, 128); BITSET_ZERO(mask128); - BITSET_SET_RANGE(mask128, 0, 31); - BITSET_SET_RANGE(mask128, 32, 63); - BITSET_SET_RANGE(mask128, 64, 95); - BITSET_SET_RANGE(mask128, 96, 127); + BITSET_SET_RANGE_INSIDE_WORD(mask128, 0, 31); + BITSET_SET_RANGE_INSIDE_WORD(mask128, 32, 63); + BITSET_SET_RANGE_INSIDE_WORD(mask128, 64, 95); + BITSET_SET_RANGE_INSIDE_WORD(mask128, 96, 127); EXPECT_EQ(BITSET_TEST_RANGE(mask128, 0, 31), true); EXPECT_EQ(BITSET_TEST_RANGE(mask128, 32, 63), true); @@ -144,8 +144,8 @@ TEST(bitset, test_and) EXPECT_EQ(BITSET_TEST_RANGE(r, 96, 127), false); - BITSET_SET_RANGE(a, 32, 63); - BITSET_SET_RANGE(b, 96, 127); + BITSET_SET_RANGE_INSIDE_WORD(a, 32, 63); + BITSET_SET_RANGE_INSIDE_WORD(b, 96, 127); BITSET_AND(r, a, b); EXPECT_EQ(BITSET_TEST_RANGE(r, 0, 31), false); @@ -182,8 +182,8 @@ TEST(bitset, test_or) EXPECT_EQ(BITSET_TEST_RANGE(r, 96, 127), false); - BITSET_SET_RANGE(a, 32, 63); - BITSET_SET_RANGE(b, 96, 127); + BITSET_SET_RANGE_INSIDE_WORD(a, 32, 63); + BITSET_SET_RANGE_INSIDE_WORD(b, 96, 127); BITSET_OR(r, a, b); EXPECT_EQ(BITSET_TEST_RANGE(r, 0, 31), false); |