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)
This commit is contained in:
Melissa Goad 2018-07-17 06:58:03 -05:00 committed by Vas Crabb
parent 1383b14883
commit b33867d92a
2 changed files with 2 additions and 2 deletions

View File

@ -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);

View File

@ -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);