From 1145007a43cb9bedcbee33455bc43c1dc4ed4785 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Tue, 14 May 2024 04:20:30 -0400 Subject: [PATCH] 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: fb994f44d91a4b947 - util: make BITSET_TEST_RANGE_INSIDE_WORD take a value to compare with Reviewed-by: Samuel Pitoiset Part-of: (cherry picked from commit 5502ecd7716045e76f13f007a4aa5f5653c80ecd) --- .pick_status.json | 2 +- src/util/bitset.h | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index 27e35538fd6..935010cf333 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -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 diff --git a/src/util/bitset.h b/src/util/bitset.h index cffbb73ecce..d5abb6c1f7c 100644 --- a/src/util/bitset.h +++ b/src/util/bitset.h @@ -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) ? \