- Fix all instances of PVS-Studio warning V578, "An odd bitwise operation

detected. Consider verifying it". [MooglyGuy]
This commit is contained in:
therealmogminer@gmail.com 2015-11-04 20:58:37 +01:00
parent 5bb4c27a6a
commit 41df8ec67b
13 changed files with 86 additions and 92 deletions

View File

@ -956,22 +956,22 @@ void am29000_cpu_device::LOAD()
if (!FREEZE_MODE)
{
m_chc = ((m_exec_ir << 8) & 0xff) |
CHC_LS |
RA << CHC_TR_SHIFT |
CHC_CV;
m_chc = ((m_exec_ir << 8) & 0xff) | CHC_LS | RA << CHC_TR_SHIFT | CHC_CV;
m_cha = addr;
m_chd = r;
if (!(m_cfg & CFG_DW) && (m_exec_ir & INST_SB_BIT))
SET_ALU_BP(addr & 3);
if (!(m_cfg & CFG_DW) && INST_SB_BIT)
{
SET_ALU_BP(addr);
}
}
m_r[RA] = r;
if (m_cfg & CFG_DW)
{
logerror("DW ON A STORE");
}
}
void am29000_cpu_device::LOADL()
@ -987,11 +987,13 @@ void am29000_cpu_device::LOADSET()
void am29000_cpu_device::LOADM()
{
UINT32 addr = INST_M_BIT ? I8: GET_RB_VAL;
UINT32 r;
if (INST_UA_BIT)
{
fatalerror("Am29000: UA bit set on LOAD\n");
}
UINT32 r;
if (INST_CE_BIT)
{
logerror("Am29000: Attempting a co-processor LOAD!\n");
@ -1019,30 +1021,28 @@ void am29000_cpu_device::LOADM()
{
// TODO
m_chc &= (CHC_CR_MASK << CHC_CR_SHIFT);
m_chc |= ((m_exec_ir << 8) & 0xff) |
RA << CHC_TR_SHIFT |
CHC_CV;
m_chc |= ((m_exec_ir << 8) & 0xff) | RA << CHC_TR_SHIFT | CHC_CV;
m_cha = addr;
m_chd = r; // ?????
if (!(m_cfg & CFG_DW) && (m_exec_ir & INST_SB_BIT))
SET_ALU_BP(addr & 3);
if (!(m_cfg & CFG_DW) && INST_SB_BIT)
{
SET_ALU_BP(addr);
}
}
r = RA;
for (INT32 cnt = 0; cnt <= GET_CHC_CR; ++cnt)
{
int cnt;
for (cnt = 0; cnt <= GET_CHC_CR; ++cnt)
{
m_r[r] = m_data->read_dword(addr);
m_r[r] = m_data->read_dword(addr);
// SET_CHC_CR(cnt - 1);
addr += 4;
addr += 4;
if (++r == 256)
r = 128;
if (++r == 256)
{
r = 128;
}
}
}
@ -1050,15 +1050,15 @@ void am29000_cpu_device::LOADM()
void am29000_cpu_device::STORE()
{
UINT32 addr = INST_M_BIT ? I8: GET_RB_VAL;
// UINT32 r;
if (INST_UA_BIT)
{
fatalerror("Am29000: UA bit set on LOAD\n");
}
if (INST_CE_BIT)
{
logerror("Am29000: Attempting a co-processor LOAD!\n");
// r = 0;
}
else
{
@ -1073,7 +1073,6 @@ void am29000_cpu_device::STORE()
SIGNAL_EXCEPTION(EXCEPTION_PROTECTION_VIOLATION);
return;
}
}
}
@ -1081,18 +1080,19 @@ void am29000_cpu_device::STORE()
if (!FREEZE_MODE)
{
m_chc = ((m_exec_ir << 8) & 0xff) |
RA << CHC_TR_SHIFT |
CHC_CV;
m_chc = ((m_exec_ir << 8) & 0xff) | RA << CHC_TR_SHIFT | CHC_CV;
m_cha = addr;
if (!(m_cfg & CFG_DW) && (m_exec_ir & INST_SB_BIT))
SET_ALU_BP(addr & 3);
if (!(m_cfg & CFG_DW) && INST_SB_BIT)
{
SET_ALU_BP(addr);
}
}
if (m_cfg & CFG_DW)
{
logerror("DW ON A STORE");
}
}
void am29000_cpu_device::STOREL()
@ -1103,11 +1103,13 @@ void am29000_cpu_device::STOREL()
void am29000_cpu_device::STOREM()
{
UINT32 addr = INST_M_BIT ? I8: GET_RB_VAL;
UINT32 r;
if (INST_UA_BIT)
{
fatalerror("Am29000: UA bit set on LOAD\n");
}
UINT32 r;
if (INST_CE_BIT)
{
logerror("Am29000: Attempting a co-processor LOAD!\n");
@ -1126,7 +1128,6 @@ void am29000_cpu_device::STOREM()
SIGNAL_EXCEPTION(EXCEPTION_PROTECTION_VIOLATION);
return;
}
}
}
@ -1134,29 +1135,26 @@ void am29000_cpu_device::STOREM()
{
// TODO
m_chc &= (CHC_CR_MASK << CHC_CR_SHIFT);
m_chc |= ((m_exec_ir << 8) & 0xff) |
RA << CHC_TR_SHIFT |
CHC_CV;
m_chc |= ((m_exec_ir << 8) & 0xff) | RA << CHC_TR_SHIFT | CHC_CV;
m_cha = addr;
if (!(m_cfg & CFG_DW) && (m_exec_ir & INST_SB_BIT))
SET_ALU_BP(addr & 3);
if (!(m_cfg & CFG_DW) && INST_SB_BIT)
{
SET_ALU_BP(addr);
}
}
r = RA;
for (INT32 cnt = 0; cnt <= GET_CHC_CR; ++cnt)
{
int cnt;
for (cnt = 0; cnt <= GET_CHC_CR; ++cnt)
m_data->write_dword(addr, m_r[r]);
addr += 4;
if (++r == 256)
{
m_data->write_dword(addr, m_r[r]);
// SET_CHC_CR(cnt - 1);
addr += 4;
if (++r == 256)
r = 128;
r = 128;
}
}
}

View File

@ -592,28 +592,28 @@ CPU_DISASSEMBLE( avr8 )
switch(op & 0x0007)
{
case 0x0000:
output += sprintf( output, "BRLO %08x", (((op & 0x0200) ? ((KCONST7(op) & 0x007f) | 0xff80) : KCONST7(op)) << 1) );
output += sprintf( output, "BRLO %08x", (((op & 0x0200) ? (KCONST7(op) | 0xff80) : KCONST7(op)) << 1) );
break;
case 0x0001:
output += sprintf( output, "BREQ %08x", (((op & 0x0200) ? ((KCONST7(op) & 0x007f) | 0xff80) : KCONST7(op)) << 1) );
output += sprintf( output, "BREQ %08x", (((op & 0x0200) ? (KCONST7(op) | 0xff80) : KCONST7(op)) << 1) );
break;
case 0x0002:
output += sprintf( output, "BRMI %08x", (((op & 0x0200) ? ((KCONST7(op) & 0x007f) | 0xff80) : KCONST7(op)) << 1) );
output += sprintf( output, "BRMI %08x", (((op & 0x0200) ? (KCONST7(op) | 0xff80) : KCONST7(op)) << 1) );
break;
case 0x0003:
output += sprintf( output, "BRVS %08x", (((op & 0x0200) ? ((KCONST7(op) & 0x007f) | 0xff80) : KCONST7(op)) << 1) );
output += sprintf( output, "BRVS %08x", (((op & 0x0200) ? (KCONST7(op) | 0xff80) : KCONST7(op)) << 1) );
break;
case 0x0004:
output += sprintf( output, "BRLT %08x", (((op & 0x0200) ? ((KCONST7(op) & 0x007f) | 0xff80) : KCONST7(op)) << 1) );
output += sprintf( output, "BRLT %08x", (((op & 0x0200) ? (KCONST7(op) | 0xff80) : KCONST7(op)) << 1) );
break;
case 0x0005:
output += sprintf( output, "BRHS %08x", (((op & 0x0200) ? ((KCONST7(op) & 0x007f) | 0xff80) : KCONST7(op)) << 1) );
output += sprintf( output, "BRHS %08x", (((op & 0x0200) ? (KCONST7(op) | 0xff80) : KCONST7(op)) << 1) );
break;
case 0x0006:
output += sprintf( output, "BRTS %08x", (((op & 0x0200) ? ((KCONST7(op) & 0x007f) | 0xff80) : KCONST7(op)) << 1) );
output += sprintf( output, "BRTS %08x", (((op & 0x0200) ? (KCONST7(op) | 0xff80) : KCONST7(op)) << 1) );
break;
case 0x0007:
output += sprintf( output, "BRIE %08x", (((op & 0x0200) ? ((KCONST7(op) & 0x007f) | 0xff80) : KCONST7(op)) << 1) );
output += sprintf( output, "BRIE %08x", (((op & 0x0200) ? (KCONST7(op) | 0xff80) : KCONST7(op)) << 1) );
break;
}
break;
@ -621,28 +621,28 @@ CPU_DISASSEMBLE( avr8 )
switch(op & 0x0007)
{
case 0x0000:
output += sprintf( output, "BRSH %08x", (((op & 0x0200) ? ((KCONST7(op) & 0x007f) | 0xff80) : KCONST7(op)) << 1) );
output += sprintf( output, "BRSH %08x", (((op & 0x0200) ? (KCONST7(op) | 0xff80) : KCONST7(op)) << 1) );
break;
case 0x0001:
output += sprintf( output, "BRNE %08x", (((op & 0x0200) ? ((KCONST7(op) & 0x007f) | 0xff80) : KCONST7(op)) << 1) );
output += sprintf( output, "BRNE %08x", (((op & 0x0200) ? (KCONST7(op) | 0xff80) : KCONST7(op)) << 1) );
break;
case 0x0002:
output += sprintf( output, "BRPL %08x", (((op & 0x0200) ? ((KCONST7(op) & 0x007f) | 0xff80) : KCONST7(op)) << 1) );
output += sprintf( output, "BRPL %08x", (((op & 0x0200) ? (KCONST7(op) | 0xff80) : KCONST7(op)) << 1) );
break;
case 0x0003:
output += sprintf( output, "BRVC %08x", (((op & 0x0200) ? ((KCONST7(op) & 0x007f) | 0xff80) : KCONST7(op)) << 1) );
output += sprintf( output, "BRVC %08x", (((op & 0x0200) ? (KCONST7(op) | 0xff80) : KCONST7(op)) << 1) );
break;
case 0x0004:
output += sprintf( output, "BRGE %08x", (((op & 0x0200) ? ((KCONST7(op) & 0x007f) | 0xff80) : KCONST7(op)) << 1) );
output += sprintf( output, "BRGE %08x", (((op & 0x0200) ? (KCONST7(op) | 0xff80) : KCONST7(op)) << 1) );
break;
case 0x0005:
output += sprintf( output, "BRHC %08x", (((op & 0x0200) ? ((KCONST7(op) & 0x007f) | 0xff80) : KCONST7(op)) << 1) );
output += sprintf( output, "BRHC %08x", (((op & 0x0200) ? (KCONST7(op) | 0xff80) : KCONST7(op)) << 1) );
break;
case 0x0006:
output += sprintf( output, "BRTC %08x", (((op & 0x0200) ? ((KCONST7(op) & 0x007f) | 0xff80) : KCONST7(op)) << 1) );
output += sprintf( output, "BRTC %08x", (((op & 0x0200) ? (KCONST7(op) | 0xff80) : KCONST7(op)) << 1) );
break;
case 0x0007:
output += sprintf( output, "BRID %08x", (((op & 0x0200) ? ((KCONST7(op) & 0x007f) | 0xff80) : KCONST7(op)) << 1) );
output += sprintf( output, "BRID %08x", (((op & 0x0200) ? (KCONST7(op) | 0xff80) : KCONST7(op)) << 1) );
break;
}
break;

View File

@ -3141,7 +3141,7 @@ void hyperstone_device::hyperstone_ldxx1(struct hyperstone_device::regs_decode *
case 2:
load = READ_HW(EXTRA_S & ~1);
load = READ_HW(EXTRA_S);
if( EXTRA_S & 1 ) // LDHS.A
{
@ -3417,7 +3417,7 @@ void hyperstone_device::hyperstone_stxx1(struct hyperstone_device::regs_decode *
case 2:
WRITE_HW(EXTRA_S & ~1, SREG & 0xffff);
WRITE_HW(EXTRA_S, SREG & 0xffff);
/*
if( EXTRA_S & 1 ) // STHS.A

View File

@ -508,7 +508,7 @@ void hd61700_cpu_device::execute_run()
case 0x15: //psr
{
UINT8 arg = read_op();
WRITE_SREG(arg, READ_REG(arg)&0x1f);
WRITE_SREG(arg, READ_REG(arg));
check_optional_jr(arg);
m_icount -= 3;
@ -1038,7 +1038,7 @@ void hd61700_cpu_device::execute_run()
case 0x55: //psr
{
UINT8 arg = read_op();
WRITE_SREG(arg, arg&0x1f);
WRITE_SREG(arg, arg);
m_icount -= 3;
}
@ -2893,7 +2893,7 @@ inline UINT8 hd61700_cpu_device::get_sir_im8(UINT8 arg)
}
else
{
return READ_SREG(arg)&0x1f;
return READ_SREG(arg);
}
}
@ -2905,7 +2905,7 @@ inline UINT8 hd61700_cpu_device::get_sir_im8(UINT8 arg, UINT8 arg1)
}
else
{
return READ_SREG(arg)&0x1f;
return READ_SREG(arg);
}
}

View File

@ -224,7 +224,7 @@ char *score7_cpu_device::disasm16(char *buffer, offs_t pc, UINT16 opcode)
buffer += sprintf(buffer, "j%s! 0x%08x", GET_J_LK(opcode) ? "l": "", (pc & 0xfffff000) | (GET_J_DISP11(opcode) << 1));
break;
case 0x04:
buffer += sprintf(buffer, "b%s! 0x%08x", m_cond[GET_BX_EC(opcode) & 0x0f], pc + sign_extend(GET_BX_DISP8(opcode) << 1, 9));
buffer += sprintf(buffer, "b%s! 0x%08x", m_cond[GET_BX_EC(opcode)], pc + sign_extend(GET_BX_DISP8(opcode) << 1, 9));
break;
case 0x05:
buffer += sprintf(buffer, "ldiu! r%d, 0x%02x", GET_I2_RD(opcode), GET_I2_IMM8(opcode));

View File

@ -252,7 +252,7 @@ int tms7000_device::op_mpy(UINT8 param1, UINT8 param2)
{
m_icount -= 39;
UINT16 t = param1 * param2;
SET_CNZ(t >> 8 & 0xff);
SET_CNZ(t >> 8);
write_mem16(0, t); // always writes result to regs A-B
return WB_NO;
}
@ -502,7 +502,7 @@ void tms7000_device::movd_dir()
m_icount -= 15;
UINT16 t = imm16();
write_r16(imm8(), t);
SET_CNZ(t >> 8 & 0xff);
SET_CNZ(t >> 8);
}
void tms7000_device::movd_inx()
@ -510,7 +510,7 @@ void tms7000_device::movd_inx()
m_icount -= 17;
UINT16 t = imm16() + read_r8(1);
write_r16(imm8(), t);
SET_CNZ(t >> 8 & 0xff);
SET_CNZ(t >> 8);
}
void tms7000_device::movd_ind()
@ -518,7 +518,7 @@ void tms7000_device::movd_ind()
m_icount -= 14;
UINT16 t = read_r16(imm8());
write_r16(imm8(), t);
SET_CNZ(t >> 8 & 0xff);
SET_CNZ(t >> 8);
}
// long branch

View File

@ -1452,7 +1452,7 @@ void sega315_5313_device::render_spriteline_to_spritebuffer(int scanline)
xxx = (xpos+xtile*8)&0x1ff;
gfxdata = MEGADRIV_VDP_VRAM((base_addr+1)&0x7fff) | (MEGADRIV_VDP_VRAM((base_addr+0)&0x7fff)<<16);
gfxdata = MEGADRIV_VDP_VRAM(base_addr+1) | (MEGADRIV_VDP_VRAM(base_addr)<<16);
for(loopcount=0;loopcount<8;loopcount++)
{

View File

@ -324,11 +324,7 @@ READ16_MEMBER(md_base_state::megadriv_68k_io_read )
{
case 0:
logerror("%06x read version register\n", space.device().safe_pc());
retdata = m_version_hi_nibble |
0x00 | // Bit 3 of Version Number
0x00 | // Bit 2 of Version Number
0x00 | // Bit 1 of Version Number
0x01 ; // Bit 0 of Version Number
retdata = m_version_hi_nibble | 0x01; // Version number contained in bits 3-0
break;
/* Joystick Port Registers */

View File

@ -285,8 +285,8 @@ void namco56xx_device::customio_run()
//popmessage("%x %x %x %x %x %x %x %x",IORAM_READ(8),IORAM_READ(9),IORAM_READ(10),IORAM_READ(11),IORAM_READ(12),IORAM_READ(13),IORAM_READ(14),IORAM_READ(15));
m_out_0_cb((offs_t)0, IORAM_READ(9) & 0x0f); // output to pins 13-16 (motos, pacnpal, gaplus)
m_out_1_cb((offs_t)0, IORAM_READ(10) & 0x0f); // output to pins 17-20 (gaplus)
m_out_0_cb((offs_t)0, IORAM_READ(9)); // output to pins 13-16 (motos, pacnpal, gaplus)
m_out_1_cb((offs_t)0, IORAM_READ(10)); // output to pins 17-20 (gaplus)
break;
case 2: // initialize coinage settings
@ -388,8 +388,8 @@ void namco58xx_device::customio_run()
//popmessage("%x %x %x %x %x %x %x %x",IORAM_READ(8),IORAM_READ(9),IORAM_READ(10),IORAM_READ(11),IORAM_READ(12),IORAM_READ(13),IORAM_READ(14),IORAM_READ(15));
m_out_0_cb((offs_t)0, IORAM_READ(9) & 0x0f); // output to pins 13-16 (toypop)
m_out_1_cb((offs_t)0, IORAM_READ(10) & 0x0f); // output to pins 17-20 (toypop)
m_out_0_cb((offs_t)0, IORAM_READ(9)); // output to pins 13-16 (toypop)
m_out_1_cb((offs_t)0, IORAM_READ(10)); // output to pins 17-20 (toypop)
break;
case 2: // initialize coinage settings

View File

@ -54,7 +54,7 @@ inline void fuuki32_state::get_tile_info8bpp(tile_data &tileinfo, tilemap_memory
{
UINT16 code = (m_vram[_N_][tile_index] & 0xffff0000) >> 16;
UINT16 attr = (m_vram[_N_][tile_index] & 0x0000ffff);
SET_TILE_INFO_MEMBER(1 + _N_, code, (attr & 0x3f) >> 4, TILE_FLIPYX((attr >> 6) & 3));
SET_TILE_INFO_MEMBER(1 + _N_, code, (attr & 0x3f) >> 4, TILE_FLIPYX(attr >> 6));
}
TILE_GET_INFO_MEMBER(fuuki32_state::get_tile_info_0){ get_tile_info8bpp(tileinfo, tile_index, 0); }
@ -64,7 +64,7 @@ inline void fuuki32_state::get_tile_info4bpp(tile_data &tileinfo, tilemap_memory
{
UINT16 code = (m_vram[_N_][tile_index] & 0xffff0000) >> 16;
UINT16 attr = (m_vram[_N_][tile_index] & 0x0000ffff);
SET_TILE_INFO_MEMBER(1 + _N_, code, attr & 0x3f, TILE_FLIPYX((attr >> 6) & 3));
SET_TILE_INFO_MEMBER(1 + _N_, code, attr & 0x3f, TILE_FLIPYX(attr >> 6));
}
TILE_GET_INFO_MEMBER(fuuki32_state::get_tile_info_2){ get_tile_info4bpp(tileinfo, tile_index, 2); }

View File

@ -57,7 +57,7 @@ TILE_GET_INFO_MEMBER(mcr_state::mcr_90010_get_tile_info)
int data = videoram[tile_index * 2] | (videoram[tile_index * 2 + 1] << 8);
int code = data & 0x1ff;
int color = (data >> 11) & 3;
SET_TILE_INFO_MEMBER(0, code, color, TILE_FLIPYX((data >> 9) & 3));
SET_TILE_INFO_MEMBER(0, code, color, TILE_FLIPYX(data >> 9));
/* sprite color base comes from the top 2 bits */
tileinfo.category = (data >> 14) & 3;
@ -83,7 +83,7 @@ TILE_GET_INFO_MEMBER(mcr_state::mcr_91490_get_tile_info)
int data = videoram[tile_index * 2] | (videoram[tile_index * 2 + 1] << 8);
int code = data & 0x3ff;
int color = (data >> 12) & 3;
SET_TILE_INFO_MEMBER(0, code, color, TILE_FLIPYX((data >> 10) & 3));
SET_TILE_INFO_MEMBER(0, code, color, TILE_FLIPYX(data >> 10));
/* sprite color base might come from the top 2 bits */
tileinfo.category = (data >> 14) & 3;

View File

@ -36,7 +36,7 @@ TILE_GET_INFO_MEMBER(mcr3_state::mcrmono_get_bg_tile_info)
int data = videoram[tile_index * 2] | (videoram[tile_index * 2 + 1] << 8);
int code = (data & 0x3ff) | ((data >> 4) & 0x400);
int color = ((data >> 12) & 3) ^ 3;
SET_TILE_INFO_MEMBER(0, code, color, TILE_FLIPYX((data >> 10) & 3));
SET_TILE_INFO_MEMBER(0, code, color, TILE_FLIPYX(data >> 10));
}

View File

@ -26,7 +26,7 @@ TILE_GET_INFO_MEMBER(mcr68_state::get_bg_tile_info)
int data = LOW_BYTE(videoram[tile_index * 2]) | (LOW_BYTE(videoram[tile_index * 2 + 1]) << 8);
int code = (data & 0x3ff) | ((data >> 4) & 0xc00);
int color = (~data >> 12) & 3;
SET_TILE_INFO_MEMBER(0, code, color, TILE_FLIPYX((data >> 10) & 3));
SET_TILE_INFO_MEMBER(0, code, color, TILE_FLIPYX(data >> 10));
if (m_gfxdecode->gfx(0)->elements() < 0x1000)
tileinfo.category = (data >> 15) & 1;
}
@ -37,7 +37,7 @@ TILE_GET_INFO_MEMBER(mcr68_state::zwackery_get_bg_tile_info)
UINT16 *videoram = m_videoram;
int data = videoram[tile_index];
int color = (data >> 13) & 7;
SET_TILE_INFO_MEMBER(0, data & 0x3ff, color, TILE_FLIPYX((data >> 11) & 3));
SET_TILE_INFO_MEMBER(0, data & 0x3ff, color, TILE_FLIPYX(data >> 11));
}
@ -46,7 +46,7 @@ TILE_GET_INFO_MEMBER(mcr68_state::zwackery_get_fg_tile_info)
UINT16 *videoram = m_videoram;
int data = videoram[tile_index];
int color = (data >> 13) & 7;
SET_TILE_INFO_MEMBER(2, data & 0x3ff, color, TILE_FLIPYX((data >> 11) & 3));
SET_TILE_INFO_MEMBER(2, data & 0x3ff, color, TILE_FLIPYX(data >> 11));
tileinfo.category = (color != 0);
}