Skip to content

function clamp(const T1 &, const T2 &, const T3 &) basic_math

template <numeric T1, numeric T2, numeric T3, typename Tout = std::common_type_t<T1, T2, T3>>
KFR_INTRINSIC Tout clamp(const T1& x, const T2& lo, const T3& hi)

Returns the first argument clamped to a range [lo, hi]

Remark

Supports integer and floating-point numbers, scalars, and vec<>.

Defined at simd/clamp.hpp:40