backend/x64/emit_x64_vector: Prevent undefined behavior within VectorSignedSaturatedShiftLeft

Avoids undefined behavior by potentially left-shifting a signed negative
value.
This commit is contained in:
Lioncash 2019-04-01 19:53:46 -04:00 committed by MerryMage
parent 46eae8cf2f
commit b37279f65c

View file

@ -3838,7 +3838,7 @@ static bool VectorSignedSaturatedShiftLeft(VectorArray<T>& dst, const VectorArra
dst[i] = saturate(element); dst[i] = saturate(element);
qc_flag = true; qc_flag = true;
} else { } else {
const T shifted = element << shift; const T shifted = T(U(element) << shift);
if ((shifted >> shift) != element) { if ((shifted >> shift) != element) {
dst[i] = saturate(element); dst[i] = saturate(element);