[PATCH 2/5] ddraw/tests: Fix absolute value warnings. (Clang)

Henri Verbeet hverbeet at gmail.com
Thu Mar 26 10:58:24 CDT 2020


On Thu, 26 Mar 2020 at 12:33, Chip Davis <cdavis at codeweavers.com> wrote:
> +static inline unsigned int absdiff(unsigned int a, unsigned int b)
> +{
> +    return a > b ? a - b : b - a;
> +}
> +
You don't need the "inline". For consistency with the other helpers
like compare_float(), I'd probably do something like the following:

    static BOOL compare_uint(unsigned int x, unsigned int y, unsigned
int max_distance)
    {
        unsigned int distance = x > y ? x - y : y - x;

        return distance <= max_distance;
    }

Note that we have one or two places where this particular issue has
already been fixed in a different way, like e.g. the d3d9:visual
tests. Ideally those would be updated as well.



More information about the wine-devel mailing list