From 4c537992290cf143bd9d4585c164698f1473376d Mon Sep 17 00:00:00 2001 From: Lioncash Date: Mon, 15 Dec 2014 23:48:39 -0500 Subject: [PATCH] armemu: Fix lower-bound signed saturation clamping for QADD16/QSUB16. --- src/core/arm/interpreter/armemu.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core/arm/interpreter/armemu.cpp b/src/core/arm/interpreter/armemu.cpp index 8ee8badd5d..e46b4d15bc 100644 --- a/src/core/arm/interpreter/armemu.cpp +++ b/src/core/arm/interpreter/armemu.cpp @@ -5867,12 +5867,12 @@ L_stm_s_takeabort: if (lo_result > 0x7FFF) lo_result = 0x7FFF; - else if (lo_result < 0x7FFF) + else if (lo_result < -0x8000) lo_result = -0x8000; if (hi_result > 0x7FFF) hi_result = 0x7FFF; - else if (hi_result < 0x7FFF) + else if (hi_result < -0x8000) hi_result = -0x8000; state->Reg[rd_idx] = (lo_result & 0xFFFF) | ((hi_result & 0xFFFF) << 16);