From e683f654ce2b143fb34c3a36d889d08af310db9c Mon Sep 17 00:00:00 2001 From: Lioncash Date: Thu, 18 Dec 2014 16:50:41 -0500 Subject: armemu: Fix lower-bounds clamping for USAT16 --- src/core/arm/interpreter/armemu.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/core/arm/interpreter/armemu.cpp b/src/core/arm/interpreter/armemu.cpp index ae865aa72..99fc6c45d 100644 --- a/src/core/arm/interpreter/armemu.cpp +++ b/src/core/arm/interpreter/armemu.cpp @@ -6201,10 +6201,15 @@ L_stm_s_takeabort: if (max < rn_lo) rn_lo = max; + else if (rn_lo < 0) + rn_lo = 0; + if (max < rn_hi) rn_hi = max; + else if (rn_hi < 0) + rn_hi = 0; - state->Reg[rd_idx] = (rn_lo & 0xFFFF) | (rn_hi); + state->Reg[rd_idx] = (rn_lo & 0xFFFF) | ((rn_hi << 16) & 0xFFFF); return 1; } -- cgit v1.2.3