PreviousNext
Shift for a smart comparison
Help > Appendix > Code Optimization > Shift for a smart comparison

FLASH-                        RAM                Speed+

 

A comparison of small numbers can be optimized by a shift.

 

uns8 upCount;

 

if ( upCount > 1 )

// or

if ( upCount >= 2 )

uns8 upCount;

 

W = upCount >> 1;

if ( W != 0 )