mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-31 14:10:09 +01:00
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>
This commit is contained in:
parent
da3f9e3626
commit
16f7d22394
1 changed files with 5 additions and 3 deletions
|
|
@ -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)) : \
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue