Skip to content

nir: fix compiler warnings about implicit conversions

Tapani Pälli requested to merge tpalli/mesa:fix-implicit-cast-warnings into master

Instead of implicitly converting UINT64_MAX to operation destination type, we explicitly set the correct max depending on type.

So instead of generating:

uint8_t dst = (src0 + src1) < src0 ? (UINT64_MAX) : (src0 + src1);

we do:

uint8_t dst = (src0 + src1) < src0 ? (UINT8_MAX) : (src0 + src1);

This clears following warnings during compilation:

warning: implicit conversion from 'unsigned long' to 'uint1_t' warning: implicit conversion from 'unsigned long' to 'uint8_t' warning: implicit conversion from 'unsigned long' to 'uint16_t' warning: implicit conversion from 'unsigned long' to 'uint32_t'

Signed-off-by: Tapani Pälli tapani.palli@intel.com

Merge request reports