Robert Hegemann Robert.Hegemann@gmx.de wrote:
Sounds like it would be better a static variable?
for (i = bound; i < 576; ++i) { static unsigned int is_pos = 7;
This way it gets it initial value once and keeps then the value from the previous iteration.
Nah, there's no reason to keep the value across function calls, and this would force the compiler to generate code to store the value in permanently allocated memory before leaving the function (two drawbacks), whereas a register or the stack work just fine.
The code would also then become non-reentrant... not that this matters at the moment, but it's nice to leave open the possibility for multi-threading and SMP.
-rob