util: shift the mask in BITSET_TEST_RANGE_INSIDE_WORD to be relative to b

so that users don't have to shift it at every use. It was supposed to be
like this from the beginning.

Fixes: fb994f44d9 - util: make BITSET_TEST_RANGE_INSIDE_WORD take a value to compare with

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29187>
(cherry picked from commit 5502ecd771)
This commit is contained in:
Marek Olšák 2024-05-14 04:20:30 -04:00 committed by Eric Engestrom
parent 4d53dba4fa
commit 1145007a43
2 changed files with 3 additions and 2 deletions

View file

@ -244,7 +244,7 @@
"description": "util: shift the mask in BITSET_TEST_RANGE_INSIDE_WORD to be relative to b",
"nominated": true,
"nomination_type": 1,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": "fb994f44d91a4b94738ea4ebb83aab1a257ef123",
"notes": null

View file

@ -209,7 +209,8 @@ __bitset_shl(BITSET_WORD *x, unsigned amount, unsigned n)
*/
#define BITSET_TEST_RANGE_INSIDE_WORD(x, b, e, mask) \
(BITSET_BITWORD(b) == BITSET_BITWORD(e) ? \
(((x)[BITSET_BITWORD(b)] & BITSET_RANGE(b, e)) == mask) : \
(((x)[BITSET_BITWORD(b)] & BITSET_RANGE(b, e)) == \
(((BITSET_WORD)mask) << (b % BITSET_WORDBITS))) : \
(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) ? \