Commit e9f45798 authored by Ell's avatar Ell

libgimpmath: add SAFE_CLAMP() macro

The SAFE_CLAMP() macro is similar to CLAMP(), however, its result
is always within the specified range, even if the input is NaN.
parent 5eb61874
......@@ -117,6 +117,20 @@ G_BEGIN_DECLS
#define CLAMP0255(a) CLAMP(a,0,255)
* @x: the value to be limited.
* @low: the lower limit.
* @high: the upper limit.
* Ensures that @x is between the limits set by @low and @high,
* even if @x is NaN. If @low is greater than @high, or if either
* of them is NaN, the result is undefined.
* Since: 2.10
#define SAFE_CLAMP(x, low, high) ((x) > (low) ? (x) < (high) ? (x) : (high) : (low))
* gimp_deg_to_rad:
* @angle: the angle to be converted.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment