mirror of
https://git.suyu.dev/suyu/dynarmic.git
synced 2026-03-06 10:32:58 +00:00
emit_x64_vector: Avoid left shift of negative value in LogicalVShift
Now that we handle the signed variants, we also have to be careful about left shifts with negative values, as this is considered undefined behavior.
This commit is contained in:
@@ -945,7 +945,8 @@ static constexpr T LogicalVShift(T x, T y) {
|
||||
return x >> T(-shift_amount);
|
||||
}
|
||||
|
||||
return x << T(shift_amount);
|
||||
using unsigned_type = std::make_unsigned_t<T>;
|
||||
return static_cast<T>(static_cast<unsigned_type>(x) << static_cast<unsigned_type>(shift_amount));
|
||||
}
|
||||
|
||||
void EmitX64::EmitVectorLogicalVShiftS8(EmitContext& ctx, IR::Inst* inst) {
|
||||
|
||||
Reference in New Issue
Block a user