[Mesa-dev] [PATCH 2/2] util: Make CLAMP turn NaN into MIN.
Chris Wilson
chris at chris-wilson.co.uk
Fri Jul 14 12:43:07 UTC 2017
Quoting Roland Scheidegger (2017-07-14 13:22:27)
> Reviewed-by: Roland Scheidegger <sroland at vmware.com>
>
> Interesting side-effect there with the results being different if max >
> min. But hopefully not an issue anywhere else...
Is it worth a gccism to check?
#ifdef __GNUC__
#define CLAMP(x, min, max) ({
typeof(x) __min = (min);
typeof(x) __max = (max);
typeof(x) __x = (x);
assert(__max >= __min);
__x > __min ? __x > __max ? __max : __x : __min;
})
#else
...
-Chris
More information about the mesa-dev
mailing list