vkd3d-shader: Avoid left shifting signed integers. (ubsan)

Otherwise ubsan reports these errors on the bitwise.shader_test:

    libs/vkd3d-shader/hlsl_constant_ops.c:970:50: runtime error: left shift of 1 by 31 places cannot be represented in type 'int'
    libs/vkd3d-shader/hlsl_constant_ops.c:970:50: runtime error: left shift of negative value -12
This commit is contained in:
Francisco Casas
2024-12-18 17:25:31 -03:00
committed by Henri Verbeet
parent 8056058aa1
commit 9b3b47b1b8
Notes: Henri Verbeet 2025-01-10 20:15:12 +01:00
Approved-by: Elizabeth Figura (@zfigura)
Approved-by: Henri Verbeet (@hverbeet)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/1327
2 changed files with 12 additions and 3 deletions

View File

@ -952,9 +952,6 @@ static bool fold_lshift(struct hlsl_ctx *ctx, struct hlsl_constant_value *dst, c
switch (src1->node.data_type->e.numeric.type)
{
case HLSL_TYPE_INT:
dst->u[k].i = src1->value.u[k].i << shift;
break;
case HLSL_TYPE_UINT:
dst->u[k].u = src1->value.u[k].u << shift;
break;