Skip to content

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

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

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

Remark

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

Defined at simd/clamp.hpp:50