Quoting Roland Scheidegger (2017-07-14 13:22:27)
> Reviewed-by: Roland Scheidegger <[email protected]>
>
> 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
_______________________________________________
mesa-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-dev