[PATCH 2/5] d3dx9_36: Implemented ID3DXConstantTable_SetIntArray and ID3DXConstantTable_SetInt

Matteo Bruni matteo.mystral at gmail.com
Wed Feb 9 07:33:59 CST 2011


2011/2/9 Travis Athougies <iammisc at gmail.com>:
>
> On Feb 8, 2011, at 4:10 AM, Matteo Bruni <matteo.mystral at gmail.com> wrote:
>
>>> +       /* We need the for loop, since we need to convert the integer to
>>> a float */
>>> +        for (i = 0; i < count && i < desc.RegisterCount; i++)
>>> +        {
>>> +            row[0] = (float)n[i];
>>
>> The cast is unneeded, and the comment above is too.
>
> If it's being passed into set*shaderconstantf, shouldn't it need to be cast
> to a float? Or am I mishnderstaning you?
>
> Travis
>

In that statement you are assigning n[i], an int, to row[0], a float.
Automatic type conversion will happen anyway, so no (float) cast is
necessary.
In general you should avoid casts unless they are really needed.



More information about the wine-devel mailing list