PreviousNext
Use DECFSZ/INCFSZ
Help > Appendix > Code Optimization > Use DECFSZ/INCFSZ

FLASH-                        RAM                Speed+

 

Loop do {} while () with a condition --var != 0 or ++var != 0 leads to the efficient compilation using

DECFSZ respectively INCFSZ instructions.

 

uns8 loop = 0;

do

{

  // execute loop body

}

while ( ++loop != 10 );

uns8 loop = 10;

do

{

  // execute loop body

}

while ( --loop != 0 );