summaryrefslogtreecommitdiff
path: root/src/video_core/macro_interpreter.cpp
diff options
context:
space:
mode:
authorGravatar Subv2018-07-30 20:09:49 -0500
committerGravatar Subv2018-07-30 20:38:24 -0500
commit8191273a3de6df8531805fbfb1a9b6e5a18076a2 (patch)
treee0995886afcfab34d09e5addc8322c42bd547ff8 /src/video_core/macro_interpreter.cpp
parentnvhost_gpu: Added checks to ensure we don't read past the end of the entries ... (diff)
downloadyuzu-8191273a3de6df8531805fbfb1a9b6e5a18076a2.tar.gz
yuzu-8191273a3de6df8531805fbfb1a9b6e5a18076a2.tar.xz
yuzu-8191273a3de6df8531805fbfb1a9b6e5a18076a2.zip
MacroInterpreter: Avoid left shifting negative values.
The branch target is signed, so multiply by 4 instead of left shifting by 2
Diffstat (limited to 'src/video_core/macro_interpreter.cpp')
-rw-r--r--src/video_core/macro_interpreter.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/video_core/macro_interpreter.cpp b/src/video_core/macro_interpreter.cpp
index 44ece01c1..377bd66ab 100644
--- a/src/video_core/macro_interpreter.cpp
+++ b/src/video_core/macro_interpreter.cpp
@@ -102,11 +102,11 @@ bool MacroInterpreter::Step(const std::vector<u32>& code, bool is_delay_slot) {
102 if (taken) { 102 if (taken) {
103 // Ignore the delay slot if the branch has the annul bit. 103 // Ignore the delay slot if the branch has the annul bit.
104 if (opcode.branch_annul) { 104 if (opcode.branch_annul) {
105 pc = base_address + (opcode.immediate << 2); 105 pc = base_address + opcode.GetBranchTarget();
106 return true; 106 return true;
107 } 107 }
108 108
109 delayed_pc = base_address + (opcode.immediate << 2); 109 delayed_pc = base_address + opcode.GetBranchTarget();
110 // Execute one more instruction due to the delay slot. 110 // Execute one more instruction due to the delay slot.
111 return Step(code, true); 111 return Step(code, true);
112 } 112 }