"Bill Knight" <bi...@rosw.com> wrote:

> If you want to speed it up even more, make i signed and test for still
> positive.
> 
> volatile int i = 1;
> P1OUT = 0;
> 
> do {
>   P1OUT++;
> } while ((i <<= 1) > 0);
> 

Well, my example was inteded to be an example for good code - it was just a
minimal example for showing the fact of the inefficient while
implementation.

I totally agree with you, that
* a do-while (if possible!) and
* writing the loop condition this way, that the compiler can use the ALU
flags
  from the previous computation
are preferrable. But this has nothing to do with the reported inefficiency.


Ralf

Reply via email to