[PATCH 07/10] d3dx9: Merge the d3dx_effect_GetInt() helper

Matteo Bruni matteo.mystral at gmail.com
Fri Mar 8 15:22:18 CST 2019


On Fri, Mar 8, 2019 at 12:15 AM Michael Stefaniuc <mstefani at winehq.org> wrote:

> +            /* all components (3,4) are clamped (0,255) and put in the INT */
> +            *n = (INT)(min(max(0.0f, *((FLOAT *)param->data + 2)), 1.0f) * INT_FLOAT_MULTI);
> +            *n += ((INT)(min(max(0.0f, *((FLOAT *)param->data + 1)), 1.0f) * INT_FLOAT_MULTI)) << 8;
> +            *n += ((INT)(min(max(0.0f, *((FLOAT *)param->data + 0)), 1.0f) * INT_FLOAT_MULTI)) << 16;
> +            if (param->columns * param->rows > 3)
> +                *n += ((INT)(min(max(0.0f, *((FLOAT *)param->data + 3)), 1.0f) * INT_FLOAT_MULTI)) << 24;

One more of those "since you're touching this" cleanup: please use
plain (C standard, lowercase) int and float types in those casts. The
first (int) cast technically isn't required but it's fine to keep for
consistency.

Also, the comment above is a bit ugly. It could be reworded but I
don't see the point of it in the first place (the code is
self-explanatory), I'd just get rid of it.



More information about the wine-devel mailing list