From 643c13668d8325d40bffea657be31ae3d19c5cea Mon Sep 17 00:00:00 2001 From: "Herman S." <429230+has207@users.noreply.github.com> Date: Sat, 18 Oct 2025 11:33:02 +0900 Subject: [PATCH] [CPU] Correctly zero extend instead of sign extending When performing unsigned multiplication on Linux/GCC, the code incorrectly cast constant.i64 (which is a signed int64_t) to unsigned __int128. This caused sign extension when the value should be treated as unsigned. --- src/xenia/cpu/hir/value.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/xenia/cpu/hir/value.cc b/src/xenia/cpu/hir/value.cc index 06c41cd8a..c1538e705 100644 --- a/src/xenia/cpu/hir/value.cc +++ b/src/xenia/cpu/hir/value.cc @@ -413,8 +413,10 @@ void Value::MulHi(Value* other, bool is_unsigned) { #else if (is_unsigned) { constant.i64 = static_cast( - (static_cast(constant.i64) * - static_cast(other->constant.i64)) >> + (static_cast( + static_cast(constant.i64)) * + static_cast( + static_cast(other->constant.i64))) >> 64); } else { constant.i64 = static_cast(