util: use *unsigned* ints for bit operations
authorEric Engestrom <eric.engestrom@intel.com>
Tue, 16 Oct 2018 08:43:07 +0000 (09:43 +0100)
committerEric Engestrom <eric.engestrom@intel.com>
Tue, 23 Oct 2018 10:44:02 +0000 (11:44 +0100)
Fixes errors thrown by GCC's Undefined Behaviour sanitizer (ubsan) every
time this macro is used.

Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
src/util/bitset.h

index adafc72a5f74d46e118a1333cc84900f0e468932..3b18abac793a0694c611da29dd411e92e7f62c6b 100644 (file)
@@ -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
  */