diff options
author | Lioncash <mathew1800@gmail.com> | 2014-12-18 20:25:07 +0100 |
---|---|---|
committer | Lioncash <mathew1800@gmail.com> | 2014-12-18 20:25:07 +0100 |
commit | 6b632bbe37d6728ec2a7a7468ffad6e058642b66 (patch) | |
tree | e197ba470a75f63c2cb5cbfe4d05a000005cf014 | |
parent | Merge pull request #299 from lioncash/join (diff) | |
download | yuzu-6b632bbe37d6728ec2a7a7468ffad6e058642b66.tar yuzu-6b632bbe37d6728ec2a7a7468ffad6e058642b66.tar.gz yuzu-6b632bbe37d6728ec2a7a7468ffad6e058642b66.tar.bz2 yuzu-6b632bbe37d6728ec2a7a7468ffad6e058642b66.tar.lz yuzu-6b632bbe37d6728ec2a7a7468ffad6e058642b66.tar.xz yuzu-6b632bbe37d6728ec2a7a7468ffad6e058642b66.tar.zst yuzu-6b632bbe37d6728ec2a7a7468ffad6e058642b66.zip |
-rw-r--r-- | src/core/arm/interpreter/armemu.cpp | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/src/core/arm/interpreter/armemu.cpp b/src/core/arm/interpreter/armemu.cpp index b9ac8b9ad..ae865aa72 100644 --- a/src/core/arm/interpreter/armemu.cpp +++ b/src/core/arm/interpreter/armemu.cpp @@ -6192,18 +6192,22 @@ L_stm_s_takeabort: //ichfly //USAT16 { - u8 tar = BITS(12, 15); - u8 src = BITS(0, 3); - u8 val = BITS(16, 19); - s16 a1 = (state->Reg[src]); - s16 a2 = (state->Reg[src] >> 0x10); - s16 max = 0xFFFF >> (16 - val); - if (max < a1) a1 = max; - if (max < a2) a2 = max; - u32 temp2 = ((u32)(a2)) << 0x10; - state->Reg[tar] = (a1 & 0xFFFF) | (temp2); + const u8 rd_idx = BITS(12, 15); + const u8 rn_idx = BITS(0, 3); + const u8 num_bits = BITS(16, 19); + const s16 max = 0xFFFF >> (16 - num_bits); + s16 rn_lo = (state->Reg[rn_idx]); + s16 rn_hi = (state->Reg[rn_idx] >> 16); + + if (max < rn_lo) + rn_lo = max; + if (max < rn_hi) + rn_hi = max; + + state->Reg[rd_idx] = (rn_lo & 0xFFFF) | (rn_hi); + return 1; } - return 1; + default: break; } |