From b33867d92a87df65058756a606adbaaa92aa80e9 Mon Sep 17 00:00:00 2001 From: Melissa Goad Date: Tue, 17 Jul 2018 06:58:03 -0500 Subject: Avoid some unintended undefined behavior in devices/cpu/i386. Spotted by cppcheck (#3753) * Avoid some unintended undefined behavior. Spotted by cppcheck * Some more undefined behavior caught by cppcheck (nw) * fixup (nw) --- src/devices/cpu/i386/i386op32.hxx | 2 +- src/devices/cpu/i386/i486ops.hxx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/devices/cpu/i386/i386op32.hxx b/src/devices/cpu/i386/i386op32.hxx index 450cf097e86..010cf91be58 100644 --- a/src/devices/cpu/i386/i386op32.hxx +++ b/src/devices/cpu/i386/i386op32.hxx @@ -318,7 +318,7 @@ void i386_device::i386_bsr_r32_rm32() // Opcode 0x0f bd } else { m_ZF = 0; dst = temp = 31; - while( (src & (1 << temp)) == 0 ) { + while( (src & (1U << temp)) == 0 ) { temp--; dst = temp; CYCLES(CYCLES_BSR); diff --git a/src/devices/cpu/i386/i486ops.hxx b/src/devices/cpu/i386/i486ops.hxx index b86a6068d24..fd346e6109d 100644 --- a/src/devices/cpu/i386/i486ops.hxx +++ b/src/devices/cpu/i386/i486ops.hxx @@ -284,9 +284,9 @@ void i386_device::i486_group0F01_16() // Opcode 0x0f 01 } case 6: /* LMSW */ { - uint16_t b; if(PROTECTED_MODE && m_CPL) FAULT(FAULT_GP,0) + uint16_t b; if( modrm >= 0xc0 ) { b = LOAD_RM16(modrm); CYCLES(CYCLES_LMSW_REG); -- cgit v1.2.3