[PATCH 1/5] d3dx9: Avoid casting each value separately in set_constants().

Matteo Bruni matteo.mystral at gmail.com
Fri Jun 9 14:52:02 CDT 2017


2017-06-09 21:38 GMT+02:00 Paul Gofman <gofmanp at gmail.com>:
> On 06/09/2017 10:14 PM, Matteo Bruni wrote:
>> The assertion I envision would check that both the source and the
>> destination data type have size == sizeof(unsigned int), which is what
>> you're depending on. It could be a static assert (see e.g.
>> C_ASSERT()), in principle.
>
> So I will put something like C_ASSERT(sizeof(BOOL) == sizeof(unsigned int)
> && sizeof(float) == sizeof(unsigned int) ...) in set_constants(), is it ok?

That one is trivially correct and won't help in case the code changes
down the line.

Something that checks that the size of a param->type component is the
same as the size of a rs->tables[table] component is the same as the
size of an unsigned int. That is what you depend on and that's what
you should verify.



More information about the wine-devel mailing list