d3dx9_36: Implement D3DXCreateBox

Andrew Nguyen anguyen at codeweavers.com
Mon Mar 28 00:39:28 CDT 2011


On 03/27/2011 04:52 PM, Joshua Beck wrote:
> On a side note, you could rearrange this loop to use less multiplications:
> +    for(i = 0; i<  24; i++)
> +    {
> +        int sixi = 6 * i;
> +        vertices[sixi    ] *= width;
> +        vertices[sixi + 1] *= height;
> +        vertices[sixi + 2] *= depth;
> +    }
> 
> Or even better:
> +    for(i = 0; i<  144; i+=4)
> +    {
> +        vertices[i  ] *= width;
> +        vertices[++i] *= height;
> +        vertices[++i] *= depth;
> +    }
> 
> 

I find that the second variant you proposed hinders comprehension of the
loop, as Dmitry's responses imply. While the first variant is perfectly
fine, I wanted to point out that in terms of code generation with
optimization enabled, the original and your variants are identical, so
your suggestions don't have any impact on runtime performance of the loop.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 899 bytes
Desc: OpenPGP digital signature
URL: <http://www.winehq.org/pipermail/wine-devel/attachments/20110328/f26a9b51/attachment.pgp>


More information about the wine-devel mailing list