PreviousNext
Compare to zero is more efficient
Help > Appendix > Code Optimization > Compare to zero is more efficient

FLASH-                        RAM                Speed+

 

Comparing to a constant zero value is more efficient than to the other constant numbers. The “~” operator takes one instruction as well as moving variable value to the working W register in the less efficient code.

 

if ( ( address & 7 ) == 7 )

if ( ( ~address & 7 ) == 0 )