From ca4df126d7c6da95ffd055919189924124a3b1ad Mon Sep 17 00:00:00 2001 From: hap Date: Fri, 26 Oct 2018 20:28:41 +0200 Subject: m68k chk2cmp2: more consistent sign check (nw) --- src/devices/cpu/m68000/m68k_in.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/devices/cpu/m68000/m68k_in.cpp b/src/devices/cpu/m68000/m68k_in.cpp index 670ff2c32b1..b5751811530 100644 --- a/src/devices/cpu/m68000/m68k_in.cpp +++ b/src/devices/cpu/m68000/m68k_in.cpp @@ -3599,7 +3599,7 @@ M68KMAKE_OP(chk2cmp2, 8, ., pcdi) int32_t upper_bound = m68ki_read_pcrel_8(ea + 1); // for signed compare, the arithmetically smaller value is the lower bound - if (lower_bound > upper_bound || compare < 0) + if (lower_bound & 0x80) { lower_bound = (int32_t)(int8_t)lower_bound; upper_bound = (int32_t)(int8_t)upper_bound; @@ -3633,7 +3633,7 @@ M68KMAKE_OP(chk2cmp2, 8, ., pcix) int32_t upper_bound = m68ki_read_pcrel_8(ea + 1); // for signed compare, the arithmetically smaller value is the lower bound - if (lower_bound > upper_bound || compare < 0) + if (lower_bound & 0x80) { lower_bound = (int32_t)(int8_t)lower_bound; upper_bound = (int32_t)(int8_t)upper_bound; @@ -3667,7 +3667,7 @@ M68KMAKE_OP(chk2cmp2, 8, ., .) int32_t upper_bound = m68ki_read_8(ea + 1); // for signed compare, the arithmetically smaller value is the lower bound - if (lower_bound > upper_bound || compare < 0) + if (lower_bound & 0x80) { lower_bound = (int32_t)(int8_t)lower_bound; upper_bound = (int32_t)(int8_t)upper_bound; @@ -3701,7 +3701,7 @@ M68KMAKE_OP(chk2cmp2, 16, ., pcdi) int32_t upper_bound = m68ki_read_pcrel_16(ea + 2); // for signed compare, the arithmetically smaller value is the lower bound - if (lower_bound > upper_bound || compare < 0) + if (lower_bound & 0x8000) { lower_bound = (int32_t)(int16_t)lower_bound; upper_bound = (int32_t)(int16_t)upper_bound; @@ -3735,7 +3735,7 @@ M68KMAKE_OP(chk2cmp2, 16, ., pcix) int32_t upper_bound = m68ki_read_pcrel_16(ea + 2); // for signed compare, the arithmetically smaller value is the lower bound - if (lower_bound > upper_bound || compare < 0) + if (lower_bound & 0x8000) { lower_bound = (int32_t)(int16_t)lower_bound; upper_bound = (int32_t)(int16_t)upper_bound; @@ -3769,7 +3769,7 @@ M68KMAKE_OP(chk2cmp2, 16, ., .) int32_t upper_bound = m68ki_read_16(ea + 2); // for signed compare, the arithmetically smaller value is the lower bound - if (lower_bound > upper_bound || compare < 0) + if (lower_bound & 0x8000) { lower_bound = (int32_t)(int16_t)lower_bound; upper_bound = (int32_t)(int16_t)upper_bound; @@ -3800,7 +3800,7 @@ M68KMAKE_OP(chk2cmp2, 32, ., pcdi) int64_t upper_bound = m68ki_read_pcrel_32(ea + 4); // for signed compare, the arithmetically smaller value is the lower bound - if (lower_bound > upper_bound) + if (lower_bound & 0x80000000) { lower_bound = (int64_t)(int32_t)lower_bound; upper_bound = (int64_t)(int32_t)upper_bound; @@ -3829,7 +3829,7 @@ M68KMAKE_OP(chk2cmp2, 32, ., pcix) int64_t upper_bound = m68ki_read_pcrel_32(ea + 4); // for signed compare, the arithmetically smaller value is the lower bound - if (lower_bound > upper_bound) + if (lower_bound & 0x80000000) { lower_bound = (int64_t)(int32_t)lower_bound; upper_bound = (int64_t)(int32_t)upper_bound; @@ -3858,7 +3858,7 @@ M68KMAKE_OP(chk2cmp2, 32, ., .) int64_t upper_bound = m68ki_read_32(ea + 4); // for signed compare, the arithmetically smaller value is the lower bound - if (lower_bound > upper_bound) + if (lower_bound & 0x80000000) { lower_bound = (int64_t)(int32_t)lower_bound; upper_bound = (int64_t)(int32_t)upper_bound; -- cgit v1.2.3