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
parent f4d63ff07d
commit 06ac561e1c
No known key found for this signature in database
GPG Key ID: 4E3C3CC1031BA9C7

View File

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