summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author hap <happppp@users.noreply.github.com>2018-10-26 20:28:41 +0200
committer hap <happppp@users.noreply.github.com>2018-10-26 20:28:57 +0200
commitca4df126d7c6da95ffd055919189924124a3b1ad (patch)
tree2d6f33d9c3e8abf2766a8a4ae04a6a3e0cd51e64
parent449e0f88eb69bf494dd976601e2e0e1880a804bf (diff)
m68k chk2cmp2: more consistent sign check (nw)
-rw-r--r--src/devices/cpu/m68000/m68k_in.cpp18
1 files 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;