d3dx9 [patch 1/3]: Avoid two useless computations

Rico Schüller kgbricola at web.de
Fri Apr 5 02:41:11 CDT 2013


On 05.04.2013 09:13, Nozomi Kodama wrote:
>       s = 0.75f;
> -    if ( order > 2 )
> -        s += 5.0f / 16.0f;
> -    if ( order > 4 )
> -        s -= 3.0f / 32.0f;
> +    if (order > 2)
> +        s = 1.0625f;
> +    if (order > 4)
> +        s = 0.96875f;
>       s /= D3DX_PI;

Doesn't the compiler do that already? If not something like this would 
probably better:

s = 0.23873...f; /* 0.75f / D3DX_PI */
if (order > 2)
	s = 1.0625f / D3DX_PI;
if (order > 4)
	s = 0.96875f / D3DX_PI;

Cheers
Rico



More information about the wine-devel mailing list