FLASH- RAM Speed-
By avoiding else branch it is possible to avoid skipping out of the if branch. This “else before if move” is possible only when it does not bring any unwanted side effects and when the slower execution does not matter. It is also better when the original else branch code is faster one and the if branch code is less frequent.
if ( checkValue( value ) ) byte |= mask; else byte &= ~mask; |
byte |= mask; if ( !checkValue( value ) ) byte &= ~mask; |
bufferCOM[ 0 ] = 0xCD; if ( value.1 ) bufferCOM[ 0 ] = 0xAB;
|
W = 0xCD; if ( value.1 ) W = 0xAB;
bufferCOM[ 0 ] = W; |