- Fix PVS-Studio warning V562, "It's odd to compare a bool type value with

a value of 0/1" [MooglyGuy]
This commit is contained in:
therealmogminer@gmail.com 2015-11-09 13:50:57 +01:00
parent 7b5119e166
commit bf5cee9b9e
10 changed files with 39 additions and 38 deletions

View File

@ -344,14 +344,14 @@ void dsp32c_device::state_export(const device_state_entry &entry)
{
case STATE_GENFLAGS:
// no actual flags register, so just make something up
m_iotemp = ((zFLAG != 0) << 0) |
((nFLAG != 0) << 1) |
((cFLAG != 0) << 2) |
((vFLAG != 0) << 3) |
((ZFLAG != 0) << 4) |
((NFLAG != 0) << 5) |
((UFLAG != 0) << 6) |
((VFLAG != 0) << 7);
m_iotemp = (zFLAG ? 0x01 : 0) |
(nFLAG ? 0x02 : 0) |
(cFLAG ? 0x04 : 0) |
(vFLAG ? 0x08 : 0) |
(ZFLAG ? 0x10 : 0) |
(NFLAG ? 0x20 : 0) |
(UFLAG ? 0x40 : 0) |
(VFLAG ? 0x80 : 0);
break;
case DSP32_PCR:

View File

@ -916,7 +916,7 @@ void i8085a_cpu_device::device_start()
m_trap_pending = 0;
m_trap_im_copy = 0;
m_sod_state = 0;
m_ietemp = 0;
m_ietemp = false;
init_tables();
@ -1005,16 +1005,24 @@ void i8085a_cpu_device::state_import(const device_state_entry &entry)
{
case I8085_SID:
if (m_ietemp)
m_IM |= IM_SID;
{
m_IM |= IM_SID;
}
else
{
m_IM &= ~IM_SID;
}
break;
case I8085_INTE:
if (m_ietemp)
{
m_IM |= IM_IE;
}
else
{
m_IM &= ~IM_IE;
}
break;
default:
@ -1028,12 +1036,7 @@ void i8085a_cpu_device::state_export(const device_state_entry &entry)
switch (entry.index())
{
case I8085_SID:
{
int sid = m_in_sid_func();
m_ietemp = ((m_IM & IM_SID) != 0);
m_ietemp = (sid != 0);
}
m_ietemp = ((m_IM & IM_SID) != 0) && m_in_sid_func() != 0;
break;
case I8085_INTE:

View File

@ -116,7 +116,7 @@ private:
UINT8 m_trap_im_copy; /* copy of IM register when TRAP was taken */
UINT8 m_sod_state; /* state of the SOD line */
UINT8 m_ietemp; /* import/export temp space */
bool m_ietemp; /* import/export temp space */
address_space *m_program;
direct_read_data *m_direct;

View File

@ -571,14 +571,14 @@ OP( 0xf2, i_repne ) { UINT32 next = fetchop(); UINT16 c = Wreg(CW);
case 0x6f: CLK(2); if (c) do { i_outsw(); c--; } while (c>0); Wreg(CW)=c; break;
case 0xa4: CLK(2); if (c) do { i_movsb(); c--; } while (c>0); Wreg(CW)=c; break;
case 0xa5: CLK(2); if (c) do { i_movsw(); c--; } while (c>0); Wreg(CW)=c; break;
case 0xa6: CLK(2); if (c) do { i_cmpsb(); c--; } while (c>0 && ZF==0); Wreg(CW)=c; break;
case 0xa7: CLK(2); if (c) do { i_cmpsw(); c--; } while (c>0 && ZF==0); Wreg(CW)=c; break;
case 0xa6: CLK(2); if (c) do { i_cmpsb(); c--; } while (c>0 && !ZF); Wreg(CW)=c; break;
case 0xa7: CLK(2); if (c) do { i_cmpsw(); c--; } while (c>0 && !ZF); Wreg(CW)=c; break;
case 0xaa: CLK(2); if (c) do { i_stosb(); c--; } while (c>0); Wreg(CW)=c; break;
case 0xab: CLK(2); if (c) do { i_stosw(); c--; } while (c>0); Wreg(CW)=c; break;
case 0xac: CLK(2); if (c) do { i_lodsb(); c--; } while (c>0); Wreg(CW)=c; break;
case 0xad: CLK(2); if (c) do { i_lodsw(); c--; } while (c>0); Wreg(CW)=c; break;
case 0xae: CLK(2); if (c) do { i_scasb(); c--; } while (c>0 && ZF==0); Wreg(CW)=c; break;
case 0xaf: CLK(2); if (c) do { i_scasw(); c--; } while (c>0 && ZF==0); Wreg(CW)=c; break;
case 0xae: CLK(2); if (c) do { i_scasb(); c--; } while (c>0 && !ZF); Wreg(CW)=c; break;
case 0xaf: CLK(2); if (c) do { i_scasw(); c--; } while (c>0 && !ZF); Wreg(CW)=c; break;
default: logerror("%06x: REPNE invalid\n",PC()); (this->*s_nec_instruction[next])();
}
m_seg_prefix=FALSE;
@ -598,14 +598,14 @@ OP( 0xf3, i_repe ) { UINT32 next = fetchop(); UINT16 c = Wreg(CW);
case 0x6f: CLK(2); if (c) do { i_outsw(); c--; } while (c>0); Wreg(CW)=c; break;
case 0xa4: CLK(2); if (c) do { i_movsb(); c--; } while (c>0); Wreg(CW)=c; break;
case 0xa5: CLK(2); if (c) do { i_movsw(); c--; } while (c>0); Wreg(CW)=c; break;
case 0xa6: CLK(2); if (c) do { i_cmpsb(); c--; } while (c>0 && ZF==1); Wreg(CW)=c; break;
case 0xa7: CLK(2); if (c) do { i_cmpsw(); c--; } while (c>0 && ZF==1); Wreg(CW)=c; break;
case 0xa6: CLK(2); if (c) do { i_cmpsb(); c--; } while (c>0 && ZF); Wreg(CW)=c; break;
case 0xa7: CLK(2); if (c) do { i_cmpsw(); c--; } while (c>0 && ZF); Wreg(CW)=c; break;
case 0xaa: CLK(2); if (c) do { i_stosb(); c--; } while (c>0); Wreg(CW)=c; break;
case 0xab: CLK(2); if (c) do { i_stosw(); c--; } while (c>0); Wreg(CW)=c; break;
case 0xac: CLK(2); if (c) do { i_lodsb(); c--; } while (c>0); Wreg(CW)=c; break;
case 0xad: CLK(2); if (c) do { i_lodsw(); c--; } while (c>0); Wreg(CW)=c; break;
case 0xae: CLK(2); if (c) do { i_scasb(); c--; } while (c>0 && ZF==1); Wreg(CW)=c; break;
case 0xaf: CLK(2); if (c) do { i_scasw(); c--; } while (c>0 && ZF==1); Wreg(CW)=c; break;
case 0xae: CLK(2); if (c) do { i_scasb(); c--; } while (c>0 && ZF); Wreg(CW)=c; break;
case 0xaf: CLK(2); if (c) do { i_scasw(); c--; } while (c>0 && ZF); Wreg(CW)=c; break;
default: logerror("%06x: REPE invalid\n",PC()); (this->*s_nec_instruction[next])();
}
m_seg_prefix=FALSE;

View File

@ -393,9 +393,9 @@ void tms5110_device::process(INT16 *buffer, unsigned int size)
* Old frame was unvoiced, new is voiced
* Old frame was unvoiced, new frame is silence/zero energy (non-existent on tms51xx rev D and F (present and working on tms52xx, present but buggy on tms51xx rev A and B))
*/
if ( ((OLD_FRAME_UNVOICED_FLAG == 0) && (NEW_FRAME_UNVOICED_FLAG == 1))
|| ((OLD_FRAME_UNVOICED_FLAG == 1) && (NEW_FRAME_UNVOICED_FLAG == 0))
|| ((OLD_FRAME_SILENCE_FLAG == 1) && (NEW_FRAME_SILENCE_FLAG == 0)) )
if ( ((OLD_FRAME_UNVOICED_FLAG == 0) && NEW_FRAME_UNVOICED_FLAG)
|| ((OLD_FRAME_UNVOICED_FLAG == 1) && !NEW_FRAME_UNVOICED_FLAG)
|| ((OLD_FRAME_SILENCE_FLAG == 1) && !NEW_FRAME_SILENCE_FLAG) )
//|| ((m_inhibit == 1) && (OLD_FRAME_UNVOICED_FLAG == 1) && (NEW_FRAME_SILENCE_FLAG == 1)) ) //TMS51xx INTERP BUG1
//|| ((OLD_FRAME_UNVOICED_FLAG == 1) && (NEW_FRAME_SILENCE_FLAG == 1)) )
m_inhibit = 1;

View File

@ -788,11 +788,11 @@ void tms5220_device::process(INT16 *buffer, unsigned int size)
* Old frame was unvoiced, new is voiced
* Old frame was unvoiced, new frame is silence/zero energy (non-existent on tms51xx rev D and F (present and working on tms52xx, present but buggy on tms51xx rev A and B))
*/
if ( ((OLD_FRAME_UNVOICED_FLAG == 0) && (NEW_FRAME_UNVOICED_FLAG == 1))
|| ((OLD_FRAME_UNVOICED_FLAG == 1) && (NEW_FRAME_UNVOICED_FLAG == 0))
|| ((OLD_FRAME_SILENCE_FLAG == 1) && (NEW_FRAME_SILENCE_FLAG == 0))
if ( ((OLD_FRAME_UNVOICED_FLAG == 0) && NEW_FRAME_UNVOICED_FLAG)
|| ((OLD_FRAME_UNVOICED_FLAG == 1) && !NEW_FRAME_UNVOICED_FLAG)
|| ((OLD_FRAME_SILENCE_FLAG == 1) && !NEW_FRAME_SILENCE_FLAG)
//|| ((m_inhibit == 1) && (OLD_FRAME_UNVOICED_FLAG == 1) && (NEW_FRAME_SILENCE_FLAG == 1)) ) //TMS51xx INTERP BUG1
|| ((OLD_FRAME_UNVOICED_FLAG == 1) && (NEW_FRAME_SILENCE_FLAG == 1)) )
|| ((OLD_FRAME_UNVOICED_FLAG == 1) && NEW_FRAME_SILENCE_FLAG) )
m_inhibit = 1;
else // normal frame, normal interpolation
m_inhibit = 0;

View File

@ -304,7 +304,7 @@ bool upd765_format::save(io_generic *io, floppy_image *image)
// Handling enough tracks is better than not
if(cn.track_count >= tracks && cc.track_count < tracks)
goto change;
else if(cn.track_count >= tracks && cc.track_count < tracks)
else if(cc.track_count >= tracks && cn.track_count < tracks)
goto dont_change;
// Both are on the same side of the track count, so closest is best

View File

@ -314,8 +314,6 @@ void rabbit_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect
xflip = (source[0]&0x00008000)>>15;
yflip = (source[0]&0x00004000)>>14;
colr = (source[1]&0x0ff00000)>>15;
tileno = (source[1]&0x0001ffff);
colr = (source[1]&0x0ff00000)>>20;

View File

@ -627,7 +627,7 @@ READ32_MEMBER( vboy_state::io_r )
// attotime new_time = machine().time();
// if((new_time - m_input_latch_time) < m_maincpu->cycles_to_attotime(640))
value |= machine().rand() & 2;
// value |= machine().rand() & 2;
value = m_vboy_regs.kcr | 0x4c;
}

View File

@ -674,8 +674,8 @@ INTERRUPT_GEN_MEMBER(namcos2_shared_state::namcos2_68k_slave_vblank)
INTERRUPT_GEN_MEMBER(namcos2_shared_state::namcos2_68k_gpu_vblank)
{
/* only used by namcos21 */
int scanline = get_posirq_scanline();
scanline = 0x50+0x89; /* HACK for Winning Run */
//int scanline = get_posirq_scanline();
INT32 scanline = 0x50+0x89; /* HACK for Winning Run */
//printf( "namcos2_68k_gpu_vblank(%d)\n",m_68k_gpu_C148[NAMCOS2_C148_POSIRQ] );
adjust_posirq_timer(scanline);