From 1492d24f89f6e156d83d6f579d1d308eaae996ef Mon Sep 17 00:00:00 2001 From: Eric Engestrom Date: Sun, 26 Nov 2023 11:22:28 +0000 Subject: [PATCH] lp: make sure 0xff is unsigned before shifting it past signed int range src/gallium/auxiliary/gallivm/lp_bld_format_s3tc.c:2446:82: runtime error: left shift of 255 by 24 places cannot be represented in type 'int' Part-of: --- src/gallium/auxiliary/gallivm/lp_bld_format_s3tc.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/gallium/auxiliary/gallivm/lp_bld_format_s3tc.c b/src/gallium/auxiliary/gallivm/lp_bld_format_s3tc.c index a3ac235a5fe..2215f2434c1 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_format_s3tc.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_format_s3tc.c @@ -2443,7 +2443,7 @@ rgtc1_to_rgba_aos(struct gallivm_state *gallivm, memset(&type8, 0, sizeof type8); type8.width = 8; type8.length = n*4; - rgba = lp_build_const_int_vec(gallivm, type, is_signed ? (0x7f << 24) : (0xff << 24)); + rgba = lp_build_const_int_vec(gallivm, type, is_signed ? (0x7f << 24) : (0xffu << 24)); rgba = LLVMBuildOr(builder, rgba, red, ""); return LLVMBuildBitCast(builder, rgba, lp_build_vec_type(gallivm, type8), ""); } @@ -2471,7 +2471,7 @@ rgtc2_to_rgba_aos(struct gallivm_state *gallivm, memset(&type8, 0, sizeof type8); type8.width = 8; type8.length = n*4; - rgba = lp_build_const_int_vec(gallivm, type, is_signed ? (0x7f << 24) : (0xff << 24)); + rgba = lp_build_const_int_vec(gallivm, type, is_signed ? (0x7f << 24) : (0xffu << 24)); rgba = LLVMBuildOr(builder, rgba, red, ""); green = LLVMBuildShl(builder, green, lp_build_const_int_vec(gallivm, type, 8), ""); rgba = LLVMBuildOr(builder, rgba, green, ""); @@ -2498,7 +2498,7 @@ latc1_to_rgba_aos(struct gallivm_state *gallivm, memset(&type8, 0, sizeof type8); type8.width = 8; type8.length = n*4; - rgba = lp_build_const_int_vec(gallivm, type, is_signed ? (0x7f << 24) : (0xff << 24)); + rgba = lp_build_const_int_vec(gallivm, type, is_signed ? (0x7f << 24) : (0xffu << 24)); rgba = LLVMBuildOr(builder, rgba, red, ""); temp = LLVMBuildShl(builder, red, lp_build_const_int_vec(gallivm, type, 8), ""); rgba = LLVMBuildOr(builder, rgba, temp, "");