- Fix PVS-Studio warning V564, "The &/| operator is applied to bool type value.

You've probably forgotten to include parentheses." [MooglyGuy]
This commit is contained in:
therealmogminer@gmail.com 2015-11-09 14:52:52 +01:00
parent bf5cee9b9e
commit 70c570dc72
26 changed files with 112 additions and 86 deletions

View File

@ -31,7 +31,7 @@ WRITE_LINE_MEMBER( luxor_4105_device::write_sasi_bsy )
{
m_sasi_bsy = state;
if (state)
if (m_sasi_bsy)
{
m_sasibus->write_sel(0);
}
@ -141,9 +141,9 @@ ioport_constructor luxor_4105_device::device_input_ports() const
inline void luxor_4105_device::update_trrq_int()
{
int cd = !m_sasi_cd;
int req = !m_sasi_req;
int trrq = !(cd & !req);
bool cd = !m_sasi_cd;
bool req = !m_sasi_req;
int trrq = (cd & !req) ? 0 : 1;
if (BIT(m_dma, 5))
{
@ -185,10 +185,10 @@ luxor_4105_device::luxor_4105_device(const machine_config &mconfig, const char *
m_cs(false),
m_data(0),
m_dma(0),
m_sasi_bsy(0),
m_sasi_req(0),
m_sasi_cd(0),
m_sasi_io(0)
m_sasi_bsy(false),
m_sasi_req(false),
m_sasi_cd(false),
m_sasi_io(false)
{
}
@ -268,10 +268,10 @@ UINT8 luxor_4105_device::abcbus_stat()
*/
data = !m_sasi_bsy;
data |= !m_sasi_req << 2;
data |= !m_sasi_cd << 3;
data |= !m_sasi_io << 6;
data = m_sasi_bsy ? 0 : (1 << 0);
data |= m_sasi_req ? 0 : (1 << 2);
data |= m_sasi_cd ? 0 : (1 << 3);
data |= m_sasi_io ? 0 : (1 << 6);
}
return data;

View File

@ -78,9 +78,9 @@ private:
UINT8 m_dma;
int m_sasi_bsy;
int m_sasi_req;
int m_sasi_cd;
int m_sasi_io;
bool m_sasi_req;
bool m_sasi_cd;
bool m_sasi_io;
};

View File

@ -224,5 +224,5 @@ int c64_easyflash_cartridge_device::c64_exrom_r(offs_t offset, int sphi2, int ba
int c64_easyflash_cartridge_device::c64_game_r(offs_t offset, int sphi2, int ba, int rw)
{
return !(BIT(m_mode, 0) | !(BIT(m_mode, 2) | m_jp1->read()));
return (BIT(m_mode, 0) || !(BIT(m_mode, 2) || m_jp1->read())) ? 0 : 1;
}

View File

@ -94,5 +94,5 @@ void c64_kingsoft_cartridge_device::c64_cd_w(address_space &space, offs_t offset
int c64_kingsoft_cartridge_device::c64_game_r(offs_t offset, int sphi2, int ba, int rw)
{
return m_exrom & !(ba & rw & ((offset >= 0x8000 && offset < 0xc000) || (offset >= 0xe000)));
return m_exrom & ((ba & rw & ((offset >= 0x8000 && offset < 0xc000) || (offset >= 0xe000))) ? 0 : 1);
}

View File

@ -124,8 +124,10 @@ WRITE8_MEMBER(nes_nanjing_device::write_l)
UINT8 temp = m_count;
m_count = data;
if (temp & !data)
m_latch2 ^= 0xff;
if ((temp & ~data) & 1)
{
m_latch2 ^= 0xff;
}
}
switch (offset & 0x300)

View File

@ -111,7 +111,7 @@ MC6845_UPDATE_ROW( wangpc_mvc_device::crtc_update_row )
for (int bit = 0; bit < 10; bit++)
{
int x = (column * 10) + bit;
int color = ((BIT(data, 9) & !ATTR_BLANK) ^ ATTR_REVERSE);
int color = ((BIT(data, 9) & ~ATTR_BLANK) ^ ATTR_REVERSE);
if ((color | bitmap.pix32(vbp + y, hbp + x)) & ATTR_BOLD) color = 2;
if (color) bitmap.pix32(vbp + y, hbp + x) = de ? PALETTE_MVC[color] : rgb_t::black;

View File

@ -1044,7 +1044,7 @@ void cquestrot_cpu_device::execute_run()
dsrclatch =
(~(0x10 << dsrc) & 0xf0)
| (rsrc ? 0x04 : 0x02)
| !(spf == SPF_SWRT);
| (spf == SPF_SWRT ? 0 : 1);
/* R-latch is written on rising edge of dsrclatch bit 2 */
if (!_BIT(m_dsrclatch, 2) && _BIT(dsrclatch, 2))
@ -1492,12 +1492,12 @@ void cquestlin_cpu_device::execute_run()
}
m_fglatch =
(!(latch == LLATCH_FADLATCH) << 5)
(latch == LLATCH_FADLATCH ? 0 : (1 << 5))
| (dowrt << 4)
| (start_stop << 3)
| (_pbcs << 2)
| (!(spf == LSPF_BRES) << 1)
| !(m_gt0reg && (spf == LSPF_BRES));
| (spf == LSPF_BRES ? 0 : (1 << 1))
| (m_gt0reg && (spf == LSPF_BRES) ? 0 : 1);
}
else
{

View File

@ -178,8 +178,8 @@ int sh34_base_device::sh4_dma_transfer(int channel, int timermode, UINT32 chcr,
}
break;
}
*sar = (*sar & !AM) | src;
*dar = (*dar & !AM) | dst;
*sar = (*sar & ~AM) | src;
*dar = (*dar & ~AM) | dst;
*dmatcr = count;
return 1;
}

View File

@ -76,13 +76,13 @@ void ttl74181_device::update()
int mp = !m_m;
// intermediate calculations
int ap0 = !(a0 | (b0 & s0) | (s1 & !b0));
int ap0 = !(a0 | (b0 & s0) | (s1 & ~b0));
int bp0 = !(((!b0) & s2 & a0) | (a0 & b0 & s3));
int ap1 = !(a1 | (b1 & s0) | (s1 & !b1));
int ap1 = !(a1 | (b1 & s0) | (s1 & ~b1));
int bp1 = !(((!b1) & s2 & a1) | (a1 & b1 & s3));
int ap2 = !(a2 | (b2 & s0) | (s1 & !b2));
int ap2 = !(a2 | (b2 & s0) | (s1 & ~b2));
int bp2 = !(((!b2) & s2 & a2) | (a2 & b2 & s3));
int ap3 = !(a3 | (b3 & s0) | (s1 & !b3));
int ap3 = !(a3 | (b3 & s0) | (s1 & ~b3));
int bp3 = !(((!b3) & s2 & a3) | (a3 & b3 & s3));
int fp0 = !(m_c & mp) ^ ((!ap0) & bp0);

View File

@ -151,7 +151,7 @@ inline void am9517a_device::dma_request(int channel, int state)
inline bool am9517a_device::is_request_active(int channel)
{
return (BIT(m_status, channel + 4) & !BIT(m_mask, channel)) ? true : false;
return (BIT(m_status, channel + 4) & ~BIT(m_mask, channel)) ? true : false;
}

View File

@ -118,8 +118,8 @@ WRITE8_MEMBER( e05a03_device::write )
break;
/* printhead */
case 0x04: m_printhead = (m_printhead & 0x100) | !data; break;
case 0x05: m_printhead = (m_printhead & 0x0ff) | (!(BIT(data, 7) << 8)); break;
case 0x04: m_printhead = (m_printhead & 0x100) | (data == 0 ? 0xff : 0); break;
case 0x05: m_printhead = (m_printhead & 0x0ff) | (BIT(data, 7) ? (1 << 8) : 0); break;
/* paper feed and carriage motor phase data*/
case 0x06: m_pf_motor = (data & 0xf0) >> 4; break;

View File

@ -134,7 +134,7 @@ void i8279_device::device_reset()
for (i = 0; i < 8; i++) m_s_ram[i] = 0;
for (i = 0; i < 16; i++) m_d_ram[i] = 0;
m_status = 0;
m_autoinc = 1;
m_autoinc = true;
m_d_ram_ptr = 0;
m_s_ram_ptr = 0;
m_read_flag = 0;
@ -374,7 +374,9 @@ READ8_MEMBER( i8279_device::data_r )
// read the display ram
data = m_d_ram[m_d_ram_ptr];
if (m_autoinc)
{
m_d_ram_ptr++;
}
}
else
if (sensor_mode)
@ -383,9 +385,13 @@ READ8_MEMBER( i8279_device::data_r )
assert(m_s_ram_ptr < ARRAY_LENGTH(m_s_ram));
data = m_s_ram[m_s_ram_ptr];
if (m_autoinc)
{
m_s_ram_ptr++;
}
else
{
set_irq(0);
}
}
else
{
@ -471,7 +477,7 @@ WRITE8_MEMBER( i8279_device::cmd_w )
WRITE8_MEMBER( i8279_device::data_w )
{//printf("Data: %X ",data);
if (BIT(m_cmd[0], 4) & m_autoinc)
if (BIT(m_cmd[0], 4) && m_autoinc)
{
// right-entry autoincrement not implemented yet
}

View File

@ -264,11 +264,11 @@ void tc0091lvc_device::device_start()
if(!m_gfxdecode->started())
throw device_missing_dependencies();
memset(m_palette_ram, 0, sizeof(m_palette_ram));
memset(m_vregs, 0, sizeof(UINT8) * 0x100);
memset(m_bitmap_ram, 0, sizeof(UINT8) * 0x20000);
memset(m_pcg_ram, 0, sizeof(UINT8) * 0x10000);
memset(m_sprram_buffer, 0, sizeof(UINT8) * 0x400);
memset(m_palette_ram, 0, ARRAY_LENGTH(m_palette_ram));
memset(m_vregs, 0, ARRAY_LENGTH(m_vregs));
memset(m_bitmap_ram, 0, ARRAY_LENGTH(m_bitmap_ram));
memset(m_pcg_ram, 0, ARRAY_LENGTH(m_pcg_ram));
memset(m_sprram_buffer, 0, ARRAY_LENGTH(m_sprram_buffer));
// note, the way tiles are addressed suggests that 0x0000-0x3fff of this might be usable,
// but we don't map it anywhere, so the first tiles are always blank at the moment.

View File

@ -520,7 +520,7 @@ if (LOG_TIMING | LOG_LOWPARAM | LOG_GLOTTAL | LOG_TRANSITION)
if (LOG_TIMING)
osd_printf_debug("%4X %4X %4X %4X %4X %4X %4X %4X %4X %4X %4X %4X %4X %4X %4X %4X ", m_master_clock, m_counter_34, m_latch_70, m_latch_72, m_beta1, m_p1, m_p2, m_phi1, m_phi2, m_phi1_20, m_phi2_20, m_subphoneme_count, m_clock_88, m_counter_84, m_latch_92, m_internal_request);
if (LOG_LOWPARAM)
osd_printf_debug("%4X %4X %4X %4X %4X ", m_srff_132, m_srff_114, m_srff_112, m_srff_142, m_latch_80);
osd_printf_debug("%d %d %d %d %d ", m_srff_132, m_srff_114, m_srff_112, m_srff_142, m_latch_80);
if (LOG_GLOTTAL)
osd_printf_debug("%4X %4X %4X %4X %4X %4X %4X ", m_counter_220, m_counter_222, m_counter_224, m_counter_234, m_counter_236, m_fgate, m_glottal_sync);
if (LOG_TRANSITION)
@ -651,7 +651,9 @@ osd_printf_debug("counter=%d\n", m_counter_84);
{
// if the request line was previously low, reset the VD/CLD flip-flops
if (m_internal_request == CLEAR_LINE)
m_srff_112 = m_srff_114 = 0;
{
m_srff_112 = m_srff_114 = false;
}
m_internal_request = ASSERT_LINE;
}
@ -684,21 +686,25 @@ osd_printf_debug("counter=%d\n", m_counter_84);
{
// update CL
case 3:
m_srff_132 = m_srff_114 & BIT(~romdata, 3);
m_srff_132 = m_srff_114 && BIT(~romdata, 3);
break;
// update CLD
case 4:
romdata_swapped = (BIT(romdata, 0) << 3) | (BIT(romdata, 1) << 2) | (BIT(romdata, 2) << 1) | (BIT(romdata, 3) << 0);
if (m_counter_84 != 0 && romdata_swapped == (m_counter_84 ^ 0xf))
m_srff_114 = 1;
{
m_srff_114 = true;
}
break;
// update VD
case 5:
romdata_swapped = (BIT(romdata, 0) << 3) | (BIT(romdata, 1) << 2) | (BIT(romdata, 2) << 1) | (BIT(romdata, 3) << 0);
if (m_counter_84 != 0 && romdata_swapped == (m_counter_84 ^ 0xf))
m_srff_112 = 1;
{
m_srff_112 = true;
}
break;
// update FF == PAC & (VA | FA)
@ -840,18 +846,22 @@ osd_printf_debug("[PH=%02X]\n", m_latch_80);
// write if not FF and low 2 bits of latch
// FF is the S/R flip-flop at 142 ANDed with !(/FA & /VA)
case 0: case 1: case 2: case 3: case 4:
if (!(m_srff_142 & !((m_fa == 0) & (m_va == 0))) && (m_latch_46 & 0x3) == 0x3)
if ((m_srff_142 && !((m_fa == 0) && (m_va == 0))) == 0 && (m_latch_46 & 0x3) == 0x3)
ram_write = 1;
break;
case 5:
if ((m_latch_46 & 0xc) == 0xc && m_srff_112)
{
ram_write = 1;
}
break;
case 6:
if ((m_latch_46 & 0xc) == 0xc && m_srff_114)
{
ram_write = 1;
}
break;
}
@ -1244,10 +1254,10 @@ void votrax_sc01_device::device_reset()
m_latch_92 = 0;
// reset low parameter clocking
m_srff_132 = 0;
m_srff_114 = 0;
m_srff_112 = 0;
m_srff_142 = 0;
m_srff_132 = false;
m_srff_114 = false;
m_srff_112 = false;
m_srff_142 = false;
m_latch_80 = 50;
update_subphoneme_clock_period();

View File

@ -98,10 +98,10 @@ private:
UINT8 m_latch_92; // 2-bit latch @ 92
// low parameter clocking
UINT8 m_srff_132; // S/R flip-flop @ 132
UINT8 m_srff_114; // S/R flip-flop @ 114
UINT8 m_srff_112; // S/R flip-flop @ 112
UINT8 m_srff_142; // S/R flip-flop @ 142
bool m_srff_132; // S/R flip-flop @ 132
bool m_srff_114; // S/R flip-flop @ 114
bool m_srff_112; // S/R flip-flop @ 112
bool m_srff_142; // S/R flip-flop @ 142
UINT8 m_latch_80; // phoneme timing latch @ 80
// glottal circuit

View File

@ -282,7 +282,7 @@ WRITE8_MEMBER( d6800_state::d6800_cassette_w )
*/
m_beeper->set_frequency(BIT(data, 0) ? 2400 : 1200);
m_beeper->set_state(BIT(data, 6) & m_cb2);
m_beeper->set_state(BIT(data, 6) & (m_cb2 ? 1 : 0));
m_portb = data & 0x7f;
}

View File

@ -346,8 +346,8 @@ WRITE32_MEMBER(gstream_state::gstream_oki_banking_w)
*/
m_oki_bank_1 = ((BIT(data, 6) & !BIT(data, 7)) << 1) | (BIT(data, 2) & BIT(data, 3));
m_oki_bank_2 = ((BIT(data, 4) & !BIT(data, 5)) << 1) | (BIT(data, 0) & BIT(data, 1));
m_oki_bank_1 = ((BIT(data, 6) & ~BIT(data, 7)) << 1) | (BIT(data, 2) & BIT(data, 3));
m_oki_bank_2 = ((BIT(data, 4) & ~BIT(data, 5)) << 1) | (BIT(data, 0) & BIT(data, 1));
//popmessage("oki bank = %X\noki_1 = %X\noki_2 = %X\n",data, m_oki_bank_1, m_oki_bank_2);

View File

@ -1272,7 +1272,7 @@ WRITE_LINE_MEMBER( inder_state::qc9b_w )
READ8_MEMBER( inder_state::ppic_r )
{
return m_pc0 | m_portc;
return (m_pc0 ? 1 : 0) | m_portc;
}
WRITE8_MEMBER( inder_state::ppia_w )

View File

@ -654,7 +654,7 @@ UINT32 sol20_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, c
chr = m_p_videoram[x & 0x3ff];
// cursor
if (BIT(chr, 7) & cursor_inv)
if (BIT(chr, 7) && cursor_inv)
inv ^= 0xff;
chr &= 0x7f;

View File

@ -472,12 +472,12 @@ WRITE_LINE_MEMBER( spinb_state::ic5m_w )
READ8_MEMBER( spinb_state::ppia_c_r )
{
return m_pc0a | m_portc_a;
return (m_pc0a ? 1 : 0) | m_portc_a;
}
READ8_MEMBER( spinb_state::ppim_c_r )
{
return m_pc0m | m_portc_m;
return (m_pc0m ? 1 : 0) | m_portc_m;
}
WRITE8_MEMBER( spinb_state::ppia_b_w )

View File

@ -438,26 +438,34 @@ WRITE8_MEMBER( st_mp200_state::u11_a_w )
if (!m_u10_ca2)
{
if (m_7d & BIT(data, 1))
m_digit = 6;
else
if BIT(data, 2)
if (m_7d && BIT(data, 1))
{
m_digit = 6;
}
else if BIT(data, 2)
{
m_digit = 5;
else
if BIT(data, 3)
}
else if BIT(data, 3)
{
m_digit = 4;
else
if BIT(data, 4)
}
else if BIT(data, 4)
{
m_digit = 3;
else
if BIT(data, 5)
}
else if BIT(data, 5)
{
m_digit = 2;
else
if BIT(data, 6)
}
else if BIT(data, 6)
{
m_digit = 1;
else
if BIT(data, 7)
}
else if BIT(data, 7)
{
m_digit = 0;
}
if (BIT(data, 0) && (m_counter > 8))
{

View File

@ -188,10 +188,10 @@ WRITE8_MEMBER(sorcerer_state::sorcerer_fe_w)
bool sound = BIT(m_iop_config->read(), 3);
m_cassette1->change_state(
(BIT(data,4) & sound) ? CASSETTE_SPEAKER_ENABLED : CASSETTE_SPEAKER_MUTED, CASSETTE_MASK_SPEAKER);
(BIT(data,4) && sound) ? CASSETTE_SPEAKER_ENABLED : CASSETTE_SPEAKER_MUTED, CASSETTE_MASK_SPEAKER);
m_cassette2->change_state(
(BIT(data,5) & sound) ? CASSETTE_SPEAKER_ENABLED : CASSETTE_SPEAKER_MUTED, CASSETTE_MASK_SPEAKER);
(BIT(data,5) && sound) ? CASSETTE_SPEAKER_ENABLED : CASSETTE_SPEAKER_MUTED, CASSETTE_MASK_SPEAKER);
/* cassette 1 motor */
m_cassette1->change_state(

View File

@ -463,9 +463,9 @@ void aerofgt_state::aerfboo2_draw_sprites( screen_device &screen, bitmap_ind16 &
pri = m_spriteram3[attr_start + 2] & 0x0010;
if ( chip_disabled_pri & !pri)
if ( chip_disabled_pri && !pri)
continue;
if ((!chip_disabled_pri) & (pri >> 4))
if ((!chip_disabled_pri) && (pri >> 4))
continue;
ox = m_spriteram3[attr_start + 1] & 0x01ff;
xsize = (m_spriteram3[attr_start + 2] & 0x0700) >> 8;

View File

@ -156,7 +156,7 @@ UINT8 aussiebyte_state::crt8002(UINT8 ac_ra, UINT8 ac_chr, UINT8 ac_attr, UINT16
gfx = 0;
if BIT(ac_attr, 5) // blank
gfx = 0;
if (ac_curs & BIT(ac_cnt, 14)) // cursor
if (ac_curs && BIT(ac_cnt, 14)) // cursor
gfx ^= 0xff;
if BIT(ac_attr, 4) // reverse video
gfx ^= 0xff;

View File

@ -469,7 +469,7 @@ void cosmic_state::nomnlnd_draw_background( screen_device &screen, bitmap_ind16
if (((!vb_) & vc_ & (!vd_)) ^ (vb_ & (!vc_) & vd_))
{
/* tree */
if ((!hd_) & hc_ & (!hb_))
if (!hd_ && hc_ && !hb_)
{
offs_t offs = ((x >> 3) & 0x03) | ((y & 0x1f) << 2) |
(flip_screen() ? 0x80 : 0);
@ -482,13 +482,13 @@ void cosmic_state::nomnlnd_draw_background( screen_device &screen, bitmap_ind16
color = (plane1 & plane2) | // R
(plane2 ) << 1 | // G
(plane1 & !plane2) << 2; // B
(plane1 & ~plane2) << 2; // B
}
}
else
{
/* water */
if (hd_ & !hc_ & hb_ & !ha_)
if (hd_ && !hc_ && hb_ && !ha_)
{
offs_t offs = hd | (water << 1) | 0x0200;

View File

@ -36,8 +36,8 @@ I8275_DRAW_CHARACTER_MEMBER( mm1_state::crtc_display_pixels )
// Step 3: Fill in missing 2 pixels in the screen bitmap by repeating last column of the char bitmap
// (works better with MikroMikko 1 font than duplicating the first and the last column)
qh = d7 & d6; // extend pixels on the right side only if there were two adjacent ones before shifting out the MSB
video_in = ((((d7 & llen) | !vsp) & !gpa0) & qh) | lten;
color = (hlt_in ? 1 : 2)*(video_in ^ compl_in);
video_in = ((((d7 & llen) | (vsp ? 0 : 1)) & (gpa0 ? 0 : 1)) & qh) | lten;
color = (hlt_in ? 1 : 2) * (video_in ^ compl_in);
bitmap.pix32(y, x + 8) = m_palette->pen(color);
bitmap.pix32(y, x + 9) = m_palette->pen(color);
}
@ -45,7 +45,7 @@ I8275_DRAW_CHARACTER_MEMBER( mm1_state::crtc_display_pixels )
for (i = 0; i < 8; ++i) // ...and now the actual character bitmap bits for this scanline
{
qh = BIT(data, i);
video_in = ((((d7 & llen) | !vsp) & !gpa0) & qh) | lten;
video_in = ((((d7 & llen) | (vsp ? 0 : 1)) & (gpa0 ? 0 : 1)) & qh) | lten;
color = (hlt_in ? 1 : 2)*(video_in ^ compl_in);
bitmap.pix32(y, x + i) = m_palette->pen(color);
}