saturation¶
satadd function (generic::satadd)¶
template <numeric T1, numeric T2,
          typename Tout = std::common_type_t<T1, T2>>
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 param T1 Type of the first operand.
Template param T2 Type of the second operand.
Template param Tout Common type deduced from T1 and T2 (result type).
Param x The first operand.
Param y The second operand.
Returns The saturated sum of x and y.
satsub function (generic::satsub)¶
template <numeric T1, numeric T2,
          typename Tout = std::common_type_t<T1, T2>>
Tout satsub(const T1 &x, const T2 &y)
Subtracts two numeric values using saturation arithmetic.
Saturated subtraction clamps the result to the maximum or minimum value
representable by the result type if overflow or underflow occurs.
Template param T1 Type of the first operand.
Template param T2 Type of the second operand.
Template param Tout Common type deduced from T1 and T2 (result type).
Param x The first operand.
Param y The second operand.
Returns The saturated difference of x and y.
Auto-generated from sources, Revision , https://github.com/kfrlib/kfr/blob//include/kfr/