Mesa (master): util: use *unsigned* ints for bit operations

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Oct 23 10:46:14 UTC 2018


Module: Mesa
Branch: master
Commit: bc021be78d2d5a36376494fca7eaf7f0728c6a29
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=bc021be78d2d5a36376494fca7eaf7f0728c6a29

Author: Eric Engestrom <eric.engestrom at intel.com>
Date:   Tue Oct 16 09:43:07 2018 +0100

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 <eric.engestrom at intel.com>
Reviewed-by: Eric Anholt <eric at anholt.net>

---

 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 adafc72a5f..3b18abac79 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
  */




More information about the mesa-commit mailing list