summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author Melissa Goad <alegend45@gmail.com>2018-07-17 06:58:03 -0500
committer Vas Crabb <cuavas@users.noreply.github.com>2018-07-17 21:58:03 +1000
commitb33867d92a87df65058756a606adbaaa92aa80e9 (patch)
tree871520c98e81782f2f4ab1c4c12751b127f009a1
parent1383b148837650193b868956d910cea6e7c56996 (diff)
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)
-rw-r--r--src/devices/cpu/i386/i386op32.hxx2
-rw-r--r--src/devices/cpu/i386/i486ops.hxx2
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);