[Mesa-dev] [PATCH 2/4] i965: Silence 'comparison is always true' warning

Ian Romanick idr at freedesktop.org
Tue Jul 15 10:56:16 PDT 2014


From: Ian Romanick <ian.d.romanick at intel.com>

The parameter is an int16_t, and we're check that it's value will fit in
16-bits.  Yes, the value that is stored in 16-bits will surely fit in
16-bits.

brw_inst.h: In function 'brw_inst_set_gen6_jump_count':
brw_inst.h:321:66: warning: comparison is always true due to limited range of data type [-Wtype-limits]
brw_inst.h:321:66: warning: comparison is always true due to limited range of data type [-Wtype-limits]

Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
---
 src/mesa/drivers/dri/i965/brw_inst.h | 2 --
 1 file changed, 2 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_inst.h b/src/mesa/drivers/dri/i965/brw_inst.h
index 719ac8e..c1ff10d 100644
--- a/src/mesa/drivers/dri/i965/brw_inst.h
+++ b/src/mesa/drivers/dri/i965/brw_inst.h
@@ -306,8 +306,6 @@ static inline void                                                            \
 brw_inst_set_##name(const struct brw_context *brw, brw_inst *inst, int16_t v) \
 {                                                                             \
    assert(assertions);                                                        \
-   assert(v <= (1 << 16) - 1);                                                \
-   assert(v > -(1 << 16));                                                    \
    (void) brw;                                                                \
    brw_inst_set_bits(inst, high, low, (uint16_t) v);                          \
 }                                                                             \
-- 
1.8.1.4



More information about the mesa-dev mailing list