2011/2/9 Travis Athougies <iamm...@gmail.com>: > > On Feb 8, 2011, at 4:10 AM, Matteo Bruni <matteo.myst...@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.