diff options
| author | Tilka <tilkax@gmail.com> | 2018-05-17 01:09:53 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-05-17 01:09:53 +0100 |
| commit | b20c7360ae3cd9576e2a05174fc7568a06d3dcb9 (patch) | |
| tree | 7b12e33dad25a2ed91d8f5a5bcf026b229dd03fa /Source/Core | |
| parent | b547f72878f954ca030c7a6d6672ee676a57eba4 (diff) | |
| parent | b29b56c61ac1adeb609fe9d68c7d5bf837f6cb0d (diff) | |
Merge pull request #6874 from lioncash/mul
Interpreter_Integer: Clean up casting in mulhwx() and mulhwux()
Diffstat (limited to 'Source/Core')
| -rw-r--r-- | Source/Core/Core/PowerPC/Interpreter/Interpreter_Integer.cpp | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/Source/Core/Core/PowerPC/Interpreter/Interpreter_Integer.cpp b/Source/Core/Core/PowerPC/Interpreter/Interpreter_Integer.cpp index d40f110481..2494e9d3a9 100644 --- a/Source/Core/Core/PowerPC/Interpreter/Interpreter_Integer.cpp +++ b/Source/Core/Core/PowerPC/Interpreter/Interpreter_Integer.cpp @@ -546,27 +546,26 @@ void Interpreter::divwux(UGeckoInstruction inst) void Interpreter::mulhwx(UGeckoInstruction inst) { - u32 a = rGPR[inst.RA]; - u32 b = rGPR[inst.RB]; - - // This can be done better. Not in plain C/C++ though. - u32 d = (u32)((u64)(((s64)(s32)a * (s64)(s32)b)) >> 32); + const s64 a = static_cast<s32>(rGPR[inst.RA]); + const s64 b = static_cast<s32>(rGPR[inst.RB]); + const u32 d = static_cast<u32>((a * b) >> 32); rGPR[inst.RD] = d; if (inst.Rc) - Helper_UpdateCR0(rGPR[inst.RD]); + Helper_UpdateCR0(d); } void Interpreter::mulhwux(UGeckoInstruction inst) { - u32 a = rGPR[inst.RA]; - u32 b = rGPR[inst.RB]; - u32 d = (u32)(((u64)a * (u64)b) >> 32); + const u64 a = rGPR[inst.RA]; + const u64 b = rGPR[inst.RB]; + const u32 d = static_cast<u32>((a * b) >> 32); + rGPR[inst.RD] = d; if (inst.Rc) - Helper_UpdateCR0(rGPR[inst.RD]); + Helper_UpdateCR0(d); } void Interpreter::mullwx(UGeckoInstruction inst) |
