# d3dx9 [patch 1/5]: Implement D3DXSHMultiply4

Rico Schüller kgbricola at web.de
Wed Sep 26 06:00:52 CDT 2012

```On 26.09.2012 12:17, Nozomi Kodama wrote:
> +    ta =0.28209479f * a+ 0.14567312f * a+ 0.12615663f * a;
> +    tb =0.28209479f * b+ 0.14567312f * b+ 0.12615663f * b;
> +    out += ta * b + tb * a;
> +    t = a * b;
> +    out +=0.28209479f *t;
The preferred way is "x = 123 * a + 456 * b; Mostly one space is
enough, only use two or more if you like to indent something, that's
mostly not the case when calculating a value. Even then, please be

> +    D3DXSHMultiply4(c, a, b);
What happens if you use something like D3DXSHMultiply4(c, c, c). Is that
allowed?

Also is there a reason why it uses slightly different values than e.g.
D3DXSHMultiply3? Why don't we use defines? A problem might be to find
good names... Maybe the Multiply functions could share the same base? To
me it looks like they do share a lot of calculations, And if the order
doesn't matter (see comment above) then it may be possible to rearrange
the calculation.

ta = 0.28209479f * a - 0.12615663f * a - 0.21850969f * a;
vs
ta = 0.28209479f * a - 0.12615662f * a - 0.21850968f * a;

Cheers
Rico

```