Forum Discussion
Altera_Forum
Honored Contributor
15 years agoActually the compiler will transform the loop you gave into:
if (wait != 0) {
do
wait = wait - 1;
while (wait != 0);
}Depending on the code layout the first conditional might get optimised for the 'wait == 0' case. You get better code from a do ... while () loop. So you want while (--wait); However, for the example code, the compiler knew the value of the constant, so won't have compiled the initial test.