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