From bc021be78d2d5a36376494fca7eaf7f0728c6a29 Mon Sep 17 00:00:00 2001 From: Eric Engestrom Date: Tue, 16 Oct 2018 09:43:07 +0100 Subject: [PATCH] util: use *unsigned* ints for bit operations Fixes errors thrown by GCC's Undefined Behaviour sanitizer (ubsan) every time this macro is used. Signed-off-by: Eric Engestrom Reviewed-by: Eric Anholt --- 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 adafc72a5f7..3b18abac793 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 */ -- 2.30.2