Skip to content

Saturated arithmetics functions

satadd function

template <typename T1, typename T2,
          KFR_ENABLE_IF(is_numeric_args<T1, T2>),
          typename Tout = common_type<T1, T2>>
Tout satadd(const T1 &x, const T2 &y)

Adds two arguments using saturation

Source code
template <typename T1, typename T2, KFR_ENABLE_IF(is_numeric_args<T1, T2>),
          typename Tout = common_type<T1, T2>>
KFR_INTRINSIC Tout satadd(const T1& x, const T2& y)
{
    return intrinsics::satadd(x, y);
}

https://github.com/kfrlib/kfr/blob//include/kfr/math/saturation.hpp#L38

template <typename E1, typename E2,
          KFR_ENABLE_IF(is_input_expressions<E1, E2>)>
internal::expression_function<fn::satadd, E1, E2>
satadd(E1 &&x, E2 &&y)

Creates an expression that adds two arguments using saturation

Source code
template <typename E1, typename E2, KFR_ENABLE_IF(is_input_expressions<E1, E2>)>
KFR_INTRINSIC internal::expression_function<fn::satadd, E1, E2> satadd(E1&& x, E2&& y)
{
    return { fn::satadd(), std::forward<E1>(x), std::forward<E2>(y) };
}

https://github.com/kfrlib/kfr/blob//include/kfr/math/saturation.hpp#L45

satsub function

template <typename T1, typename T2,
          KFR_ENABLE_IF(is_numeric_args<T1, T2>),
          typename Tout = common_type<T1, T2>>
Tout satsub(const T1 &x, const T2 &y)

Subtracts two arguments using saturation

Source code
template <typename T1, typename T2, KFR_ENABLE_IF(is_numeric_args<T1, T2>),
          typename Tout = common_type<T1, T2>>
KFR_INTRINSIC Tout satsub(const T1& x, const T2& y)
{
    return intrinsics::satsub(x, y);
}

https://github.com/kfrlib/kfr/blob//include/kfr/math/saturation.hpp#L53

template <typename E1, typename E2,
          KFR_ENABLE_IF(is_input_expressions<E1, E2>)>
internal::expression_function<fn::satsub, E1, E2>
satsub(E1 &&x, E2 &&y)

Creates an expression that subtracts two arguments using saturation

Source code
template <typename E1, typename E2, KFR_ENABLE_IF(is_input_expressions<E1, E2>)>
KFR_INTRINSIC internal::expression_function<fn::satsub, E1, E2> satsub(E1&& x, E2&& y)
{
    return { fn::satsub(), std::forward<E1>(x), std::forward<E2>(y) };
}

https://github.com/kfrlib/kfr/blob//include/kfr/math/saturation.hpp#L60


Auto-generated from sources, Revision , https://github.com/kfrlib/kfr/blob//include/kfr/