'Expensive' expressions in loop limits (was: Implementation of D3DXSHScale)

2012-06-19 Thread Dan Kegel
Nozomi wrote: +for (i = 0; i order * order; i++) I might have written int n = order * order; for (i=0; i n; i++) to avoid repeating the multiplication every time around the loop, even though multiplication is cheap nowadays, and -O1 will optimize it out anyway. Staying in the

Re: 'Expensive' expressions in loop limits (was: Implementation of D3DXSHScale)

2012-06-19 Thread Michael Stefaniuc
On 06/19/2012 10:47 AM, Dan Kegel wrote: Nozomi wrote: +for (i = 0; i order * order; i++) I might have written int n = order * order; for (i=0; i n; i++) to avoid repeating the multiplication every time around the loop, even though multiplication is cheap nowadays, and -O1