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:
parent
46eae8cf2f
commit
b37279f65c
1 changed files with 1 additions and 1 deletions
|
@ -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);
|
||||||
|
|
Loading…
Reference in a new issue