If the trinary operator is used and the destination is
a bit, a lot of unnecessary operations are generated:
#define LED_OFF 1
#define LED_ON 0
#define LED_at_Portpin P1_0
unsigned char value = 0;
void main (void)
LED_at_Portpin = value < 2 ? LED_OFF : LED_ON;
The code doesn't become better if 0 and 1 is defined
as false and true using stdbool.h
In this case a additional sloc is generated.
I solved this by adding 3 more peepholes. I think the
solution can and should be made at icode level by
Log in to post a comment.