Skip to content

function satadd(const T1 &, const T2 &) saturation

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

Adds two numeric values using saturation arithmetic.

Saturated addition clamps the result to the maximum or minimum value representable by the result type if overflow or underflow occurs.

Template parameters
T1 Type of the first operand.
T2 Type of the second operand.
Tout Common type deduced from T1 and T2 (result type).
Parameters
x The first operand.
y The second operand.
Returns
The saturated sum of x and y.

Defined at simd/saturation.hpp:49