[Mesa-dev] [PATCH mesa] util: use *unsigned* ints for bit operations
Eric Engestrom
eric.engestrom at intel.com
Tue Oct 16 08:46:29 UTC 2018
Fixes errors thrown by GCC's Undefined Behaviour sanitizer (ubsan) every
time this macro is used.
Signed-off-by: Eric Engestrom <eric.engestrom at intel.com>
---
src/util/bitset.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/util/bitset.h b/src/util/bitset.h
index adafc72a5f74d46e118a..3b18abac793a0694c611 100644
--- a/src/util/bitset.h
+++ b/src/util/bitset.h
@@ -54,7 +54,7 @@
#define BITSET_ONES(x) memset( (x), 0xff, sizeof (x) )
#define BITSET_BITWORD(b) ((b) / BITSET_WORDBITS)
-#define BITSET_BIT(b) (1 << ((b) % BITSET_WORDBITS))
+#define BITSET_BIT(b) (1u << ((b) % BITSET_WORDBITS))
/* single bit operations
*/
--
Cheers,
Eric
More information about the mesa-dev
mailing list