Simplify some expressions using the ? operator

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@24136 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Bertrik Sikken 2010-01-01 22:47:25 +00:00
parent e35a15cf54
commit 5c4ef78cc9
8 changed files with 10 additions and 12 deletions

View file

@ -250,7 +250,7 @@ void mixer_playsample(int channel, int instrument)
p_channel->channelactive = true; p_channel->channelactive = true;
p_channel->samplepos = p_instrument->sampledataoffset; p_channel->samplepos = p_instrument->sampledataoffset;
p_channel->samplefractpos = 0; p_channel->samplefractpos = 0;
p_channel->loopsample = (p_instrument->repeatlength > 2) ? true : false; p_channel->loopsample = (p_instrument->repeatlength > 2);
if (p_channel->loopsample) { if (p_channel->loopsample) {
p_channel->loopstart = p_instrument->repeatoffset + p_channel->loopstart = p_instrument->repeatoffset +
p_instrument->sampledataoffset; p_instrument->sampledataoffset;
@ -807,8 +807,7 @@ void playline(int pattern, int line)
{ {
/* Set Filter */ /* Set Filter */
case 0x0: case 0x0:
modplayer.amigafilterenabled = modplayer.amigafilterenabled = (effecty == 0);
(effecty>0) ? false : true;
break; break;
/* Fineslide up */ /* Fineslide up */
case 0x1: case 0x1:
@ -834,8 +833,7 @@ void playline(int pattern, int line)
break; break;
/* Set glissando on/off */ /* Set glissando on/off */
case 0x3: case 0x3:
modplayer.glissandoenabled = modplayer.glissandoenabled = (effecty > 0);
(effecty > 0) ? true:false;
break; break;
/* Set Vibrato waveform */ /* Set Vibrato waveform */
case 0x4: case 0x4:

View file

@ -285,7 +285,7 @@ static unsigned viewport_init_ui_vp(void)
ret = viewport_parse_viewport(&custom_vp[screen], screen, ret = viewport_parse_viewport(&custom_vp[screen], screen,
setting, ','); setting, ',');
custom_vp_loaded_ok[screen] = ret?true:false; custom_vp_loaded_ok[screen] = (ret != NULL);
} }
return true; /* meh fixme */ return true; /* meh fixme */
} }

View file

@ -571,7 +571,7 @@ static bool delete_handler(bool is_dir)
if (!res) if (!res)
onplay_result = ONPLAY_RELOAD_DIR; onplay_result = ONPLAY_RELOAD_DIR;
return ((res == 0) ? true:false); return (res == 0);
} }

View file

@ -608,7 +608,7 @@ static struct card new_card(void) {
new_card.suit = rb->rand()%4; /* Random number 0-3 */ new_card.suit = rb->rand()%4; /* Random number 0-3 */
new_card.num = rb->rand()%13; /* Random number 0-12 */ new_card.num = rb->rand()%13; /* Random number 0-12 */
new_card.value = find_value(new_card.num); new_card.value = find_value(new_card.num);
new_card.is_soft_ace = new_card.num == 0 ? true : false; new_card.is_soft_ace = (new_card.num == 0);
return new_card; return new_card;
} }

View file

@ -693,7 +693,7 @@ static int clix_handle_game(struct clix_game_state_t* state)
while(true) while(true)
{ {
if (TIME_AFTER(*rb->current_tick, blink_tick)) { if (TIME_AFTER(*rb->current_tick, blink_tick)) {
state->blink = state->blink ? false : true; state->blink = !state->blink;
blink_tick = *rb->current_tick + BLINK_TICKCOUNT; blink_tick = *rb->current_tick + BLINK_TICKCOUNT;
} }

View file

@ -816,7 +816,7 @@ void mmc_enable_monitoring(bool on)
bool mmc_detect(void) bool mmc_detect(void)
{ {
return adc_read(ADC_MMC_SWITCH) < 0x200 ? true : false; return (adc_read(ADC_MMC_SWITCH) < 0x200);
} }
bool mmc_touched(void) bool mmc_touched(void)

View file

@ -359,7 +359,7 @@ static int sd_init_card(const int drive)
sd_parse_csd(&card_info[drive]); sd_parse_csd(&card_info[drive]);
#if defined(HAVE_MULTIDRIVE) #if defined(HAVE_MULTIDRIVE)
hs_card = (card_info[drive].speed == 50000000) ? true : false; hs_card = (card_info[drive].speed == 50000000);
#endif #endif
/* Boost MCICLK to operating speed */ /* Boost MCICLK to operating speed */

View file

@ -53,7 +53,7 @@ int tuner_set(int setting, int value)
break; break;
case RADIO_FORCE_MONO: case RADIO_FORCE_MONO:
mono = value?true:false; mono = (value != 0);
break; break;
default: default: