[Mesa-dev] [PATCH 08/21] i965: Fix undefined signed overflow in INTEL_MASK for bitfields of 31 bits.

Francisco Jerez currojerez at riseup.net
Sat Jul 23 03:59:02 UTC 2016


Most likely we had only ever used this macro on bitfields of less than
31 bits -- That's going to change shortly.
---
 src/mesa/drivers/dri/i965/brw_defines.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/mesa/drivers/dri/i965/brw_defines.h b/src/mesa/drivers/dri/i965/brw_defines.h
index 2814fa7..2368931 100644
--- a/src/mesa/drivers/dri/i965/brw_defines.h
+++ b/src/mesa/drivers/dri/i965/brw_defines.h
@@ -29,7 +29,7 @@
   *   Keith Whitwell <keithw at vmware.com>
   */
 
-#define INTEL_MASK(high, low) (((1<<((high)-(low)+1))-1)<<(low))
+#define INTEL_MASK(high, low) (((1u<<((high)-(low)+1))-1)<<(low))
 /* Using the GNU statement expression extension */
 #define SET_FIELD(value, field)                                         \
    ({                                                                   \
-- 
2.9.0



More information about the mesa-dev mailing list