commit 4f113b3f6d57a74e78f3ce80061bd8f3a11b3797
parent a8d7d689c039af7e854645b6473b204688a8b3cf
Author: d.levin256@gmail.com <d.levin256@gmail.com>
Date: Mon, 17 Oct 2016 07:25:13 +0300
Replace KFR_INTRIN by CMT_FUNC
Diffstat:
4 files changed, 50 insertions(+), 48 deletions(-)
diff --git a/include/kfr/base/gamma.hpp b/include/kfr/base/gamma.hpp
@@ -68,25 +68,25 @@ KFR_I_FN(gamma)
KFR_I_FN(factorial_approx)
template <typename T1, KFR_ENABLE_IF(is_numeric<T1>::value)>
-KFR_INTRIN flt_type<T1> gamma(const T1& x)
+CMT_FUNC flt_type<T1> gamma(const T1& x)
{
return intrinsics::gamma(x);
}
template <typename E1, KFR_ENABLE_IF(is_input_expression<E1>::value)>
-KFR_INTRIN internal::expression_function<fn::gamma, E1> gamma(E1&& x)
+CMT_FUNC internal::expression_function<fn::gamma, E1> gamma(E1&& x)
{
return { fn::gamma(), std::forward<E1>(x) };
}
template <typename T1, KFR_ENABLE_IF(is_numeric<T1>::value)>
-KFR_INTRIN flt_type<T1> factorial_approx(const T1& x)
+CMT_FUNC flt_type<T1> factorial_approx(const T1& x)
{
return intrinsics::factorial_approx(x);
}
template <typename E1, KFR_ENABLE_IF(is_input_expression<E1>::value)>
-KFR_INTRIN internal::expression_function<fn::factorial_approx, E1> factorial_approx(E1&& x)
+CMT_FUNC internal::expression_function<fn::factorial_approx, E1> factorial_approx(E1&& x)
{
return { fn::factorial_approx(), std::forward<E1>(x) };
}
diff --git a/include/kfr/base/hyperbolic.hpp b/include/kfr/base/hyperbolic.hpp
@@ -41,13 +41,15 @@ namespace intrinsics
template <typename T, size_t N, typename Tout = flt_type<T>>
KFR_SINTRIN vec<Tout, N> sinh(const vec<T, N>& x)
{
- return (exp(x) - exp(-x)) * Tout(0.5);
+ const vec<Tout, N> xx = static_cast<vec<Tout, N>>(x);
+ return (exp(xx) - exp(-xx)) * Tout(0.5);
}
template <typename T, size_t N, typename Tout = flt_type<T>>
KFR_SINTRIN vec<Tout, N> cosh(const vec<T, N>& x)
{
- return (exp(x) + exp(-x)) * Tout(0.5);
+ const vec<Tout, N> xx = static_cast<vec<Tout, N>>(x);
+ return (exp(xx) + exp(-xx)) * Tout(0.5);
}
template <typename T, size_t N, typename Tout = flt_type<T>>
@@ -95,73 +97,73 @@ KFR_I_FN(sinhcosh)
KFR_I_FN(coshsinh)
template <typename T1, KFR_ENABLE_IF(is_numeric<T1>::value)>
-KFR_INTRIN flt_type<T1> sinh(const T1& x)
+CMT_FUNC flt_type<T1> sinh(const T1& x)
{
return intrinsics::sinh(x);
}
template <typename E1, KFR_ENABLE_IF(is_input_expression<E1>::value)>
-KFR_INTRIN internal::expression_function<fn::sinh, E1> sinh(E1&& x)
+CMT_FUNC internal::expression_function<fn::sinh, E1> sinh(E1&& x)
{
return { fn::sinh(), std::forward<E1>(x) };
}
template <typename T1, KFR_ENABLE_IF(is_numeric<T1>::value)>
-KFR_INTRIN flt_type<T1> cosh(const T1& x)
+CMT_FUNC flt_type<T1> cosh(const T1& x)
{
return intrinsics::cosh(x);
}
template <typename E1, KFR_ENABLE_IF(is_input_expression<E1>::value)>
-KFR_INTRIN internal::expression_function<fn::cosh, E1> cosh(E1&& x)
+CMT_FUNC internal::expression_function<fn::cosh, E1> cosh(E1&& x)
{
return { fn::cosh(), std::forward<E1>(x) };
}
template <typename T1, KFR_ENABLE_IF(is_numeric<T1>::value)>
-KFR_INTRIN flt_type<T1> tanh(const T1& x)
+CMT_FUNC flt_type<T1> tanh(const T1& x)
{
return intrinsics::tanh(x);
}
template <typename E1, KFR_ENABLE_IF(is_input_expression<E1>::value)>
-KFR_INTRIN internal::expression_function<fn::tanh, E1> tanh(E1&& x)
+CMT_FUNC internal::expression_function<fn::tanh, E1> tanh(E1&& x)
{
return { fn::tanh(), std::forward<E1>(x) };
}
template <typename T1, KFR_ENABLE_IF(is_numeric<T1>::value)>
-KFR_INTRIN flt_type<T1> coth(const T1& x)
+CMT_FUNC flt_type<T1> coth(const T1& x)
{
return intrinsics::coth(x);
}
template <typename E1, KFR_ENABLE_IF(is_input_expression<E1>::value)>
-KFR_INTRIN internal::expression_function<fn::coth, E1> coth(E1&& x)
+CMT_FUNC internal::expression_function<fn::coth, E1> coth(E1&& x)
{
return { fn::coth(), std::forward<E1>(x) };
}
template <typename T1, KFR_ENABLE_IF(is_numeric<T1>::value)>
-KFR_INTRIN flt_type<T1> sinhcosh(const T1& x)
+CMT_FUNC flt_type<T1> sinhcosh(const T1& x)
{
return intrinsics::sinhcosh(x);
}
template <typename E1, KFR_ENABLE_IF(is_input_expression<E1>::value)>
-KFR_INTRIN internal::expression_function<fn::sinhcosh, E1> sinhcosh(E1&& x)
+CMT_FUNC internal::expression_function<fn::sinhcosh, E1> sinhcosh(E1&& x)
{
return { fn::sinhcosh(), std::forward<E1>(x) };
}
template <typename T1, KFR_ENABLE_IF(is_numeric<T1>::value)>
-KFR_INTRIN flt_type<T1> coshsinh(const T1& x)
+CMT_FUNC flt_type<T1> coshsinh(const T1& x)
{
return intrinsics::coshsinh(x);
}
template <typename E1, KFR_ENABLE_IF(is_input_expression<E1>::value)>
-KFR_INTRIN internal::expression_function<fn::coshsinh, E1> coshsinh(E1&& x)
+CMT_FUNC internal::expression_function<fn::coshsinh, E1> coshsinh(E1&& x)
{
return { fn::coshsinh(), std::forward<E1>(x) };
}
diff --git a/include/kfr/base/log_exp.hpp b/include/kfr/base/log_exp.hpp
@@ -312,169 +312,169 @@ KFR_I_FN(root)
KFR_I_FN(cbrt)
template <typename T1, KFR_ENABLE_IF(is_numeric<T1>::value)>
-KFR_INTRIN flt_type<T1> exp(const T1& x)
+CMT_FUNC flt_type<T1> exp(const T1& x)
{
return intrinsics::exp(x);
}
template <typename E1, KFR_ENABLE_IF(is_input_expression<E1>::value)>
-KFR_INTRIN internal::expression_function<fn::exp, E1> exp(E1&& x)
+CMT_FUNC internal::expression_function<fn::exp, E1> exp(E1&& x)
{
return { fn::exp(), std::forward<E1>(x) };
}
template <typename T1, KFR_ENABLE_IF(is_numeric<T1>::value)>
-KFR_INTRIN flt_type<T1> exp2(const T1& x)
+CMT_FUNC flt_type<T1> exp2(const T1& x)
{
return intrinsics::exp2(x);
}
template <typename E1, KFR_ENABLE_IF(is_input_expression<E1>::value)>
-KFR_INTRIN internal::expression_function<fn::exp2, E1> exp2(E1&& x)
+CMT_FUNC internal::expression_function<fn::exp2, E1> exp2(E1&& x)
{
return { fn::exp2(), std::forward<E1>(x) };
}
template <typename T1, KFR_ENABLE_IF(is_numeric<T1>::value)>
-KFR_INTRIN flt_type<T1> exp10(const T1& x)
+CMT_FUNC flt_type<T1> exp10(const T1& x)
{
return intrinsics::exp10(x);
}
template <typename E1, KFR_ENABLE_IF(is_input_expression<E1>::value)>
-KFR_INTRIN internal::expression_function<fn::exp10, E1> exp10(E1&& x)
+CMT_FUNC internal::expression_function<fn::exp10, E1> exp10(E1&& x)
{
return { fn::exp10(), std::forward<E1>(x) };
}
template <typename T1, KFR_ENABLE_IF(is_numeric<T1>::value)>
-KFR_INTRIN flt_type<T1> log(const T1& x)
+CMT_FUNC flt_type<T1> log(const T1& x)
{
return intrinsics::log(x);
}
template <typename E1, KFR_ENABLE_IF(is_input_expression<E1>::value)>
-KFR_INTRIN internal::expression_function<fn::log, E1> log(E1&& x)
+CMT_FUNC internal::expression_function<fn::log, E1> log(E1&& x)
{
return { fn::log(), std::forward<E1>(x) };
}
template <typename T1, KFR_ENABLE_IF(is_numeric<T1>::value)>
-KFR_INTRIN flt_type<T1> log2(const T1& x)
+CMT_FUNC flt_type<T1> log2(const T1& x)
{
return intrinsics::log2(x);
}
template <typename E1, KFR_ENABLE_IF(is_input_expression<E1>::value)>
-KFR_INTRIN internal::expression_function<fn::log2, E1> log2(E1&& x)
+CMT_FUNC internal::expression_function<fn::log2, E1> log2(E1&& x)
{
return { fn::log2(), std::forward<E1>(x) };
}
template <typename T1, KFR_ENABLE_IF(is_numeric<T1>::value)>
-KFR_INTRIN flt_type<T1> log10(const T1& x)
+CMT_FUNC flt_type<T1> log10(const T1& x)
{
return intrinsics::log10(x);
}
template <typename E1, KFR_ENABLE_IF(is_input_expression<E1>::value)>
-KFR_INTRIN internal::expression_function<fn::log10, E1> log10(E1&& x)
+CMT_FUNC internal::expression_function<fn::log10, E1> log10(E1&& x)
{
return { fn::log10(), std::forward<E1>(x) };
}
template <typename T1, KFR_ENABLE_IF(is_numeric<T1>::value)>
-KFR_INTRIN flt_type<T1> logb(const T1& x)
+CMT_FUNC flt_type<T1> logb(const T1& x)
{
return intrinsics::logb(x);
}
template <typename E1, KFR_ENABLE_IF(is_input_expression<E1>::value)>
-KFR_INTRIN internal::expression_function<fn::logb, E1> logb(E1&& x)
+CMT_FUNC internal::expression_function<fn::logb, E1> logb(E1&& x)
{
return { fn::logb(), std::forward<E1>(x) };
}
template <typename T1, typename T2, KFR_ENABLE_IF(is_numeric_args<T1, T2>::value)>
-KFR_INTRIN flt_type<common_type<T1, T2>> logn(const T1& x, const T2& y)
+CMT_FUNC flt_type<common_type<T1, T2>> logn(const T1& x, const T2& y)
{
return intrinsics::logn(x, y);
}
template <typename E1, typename E2, KFR_ENABLE_IF(is_input_expressions<E1, E2>::value)>
-KFR_INTRIN internal::expression_function<fn::logn, E1, E2> logn(E1&& x, E2&& y)
+CMT_FUNC internal::expression_function<fn::logn, E1, E2> logn(E1&& x, E2&& y)
{
return { fn::logn(), std::forward<E1>(x), std::forward<E2>(y) };
}
template <typename T1, typename T2, KFR_ENABLE_IF(is_numeric_args<T1, T2>::value)>
-KFR_INTRIN flt_type<common_type<T1, T2>> logm(const T1& x, const T2& y)
+CMT_FUNC flt_type<common_type<T1, T2>> logm(const T1& x, const T2& y)
{
return intrinsics::logm(x, y);
}
template <typename E1, typename E2, KFR_ENABLE_IF(is_input_expressions<E1, E2>::value)>
-KFR_INTRIN internal::expression_function<fn::logm, E1, E2> logm(E1&& x, E2&& y)
+CMT_FUNC internal::expression_function<fn::logm, E1, E2> logm(E1&& x, E2&& y)
{
return { fn::logm(), std::forward<E1>(x), std::forward<E2>(y) };
}
template <typename T1, typename T2, typename T3, KFR_ENABLE_IF(is_numeric_args<T1, T2, T3>::value)>
-KFR_INTRIN flt_type<common_type<T1, T2, T3>> exp_fmadd(const T1& x, const T2& y, const T3& z)
+CMT_FUNC flt_type<common_type<T1, T2, T3>> exp_fmadd(const T1& x, const T2& y, const T3& z)
{
return intrinsics::exp_fmadd(x, y, z);
}
template <typename E1, typename E2, typename E3, KFR_ENABLE_IF(is_input_expressions<E1, E2, E3>::value)>
-KFR_INTRIN internal::expression_function<fn::exp_fmadd, E1, E2, E3> exp_fmadd(E1&& x, E2&& y, E3&& z)
+CMT_FUNC internal::expression_function<fn::exp_fmadd, E1, E2, E3> exp_fmadd(E1&& x, E2&& y, E3&& z)
{
return { fn::exp_fmadd(), std::forward<E1>(x), std::forward<E2>(y), std::forward<E3>(z) };
}
template <typename T1, typename T2, typename T3, KFR_ENABLE_IF(is_numeric_args<T1, T2, T3>::value)>
-KFR_INTRIN flt_type<common_type<T1, T2, T3>> log_fmadd(const T1& x, const T2& y, const T3& z)
+CMT_FUNC flt_type<common_type<T1, T2, T3>> log_fmadd(const T1& x, const T2& y, const T3& z)
{
return intrinsics::log_fmadd(x, y, z);
}
template <typename E1, typename E2, typename E3, KFR_ENABLE_IF(is_input_expressions<E1, E2, E3>::value)>
-KFR_INTRIN internal::expression_function<fn::log_fmadd, E1, E2, E3> log_fmadd(E1&& x, E2&& y, E3&& z)
+CMT_FUNC internal::expression_function<fn::log_fmadd, E1, E2, E3> log_fmadd(E1&& x, E2&& y, E3&& z)
{
return { fn::log_fmadd(), std::forward<E1>(x), std::forward<E2>(y), std::forward<E3>(z) };
}
template <typename T1, typename T2, KFR_ENABLE_IF(is_numeric_args<T1, T2>::value)>
-KFR_INTRIN flt_type<common_type<T1, T2>> pow(const T1& x, const T2& y)
+CMT_FUNC flt_type<common_type<T1, T2>> pow(const T1& x, const T2& y)
{
return intrinsics::pow(x, y);
}
template <typename E1, typename E2, KFR_ENABLE_IF(is_input_expressions<E1, E2>::value)>
-KFR_INTRIN internal::expression_function<fn::pow, E1, E2> pow(E1&& x, E2&& y)
+CMT_FUNC internal::expression_function<fn::pow, E1, E2> pow(E1&& x, E2&& y)
{
return { fn::pow(), std::forward<E1>(x), std::forward<E2>(y) };
}
template <typename T1, typename T2, KFR_ENABLE_IF(is_numeric_args<T1, T2>::value)>
-KFR_INTRIN flt_type<common_type<T1, T2>> root(const T1& x, const T2& y)
+CMT_FUNC flt_type<common_type<T1, T2>> root(const T1& x, const T2& y)
{
return intrinsics::root(x, y);
}
template <typename E1, typename E2, KFR_ENABLE_IF(is_input_expressions<E1, E2>::value)>
-KFR_INTRIN internal::expression_function<fn::root, E1, E2> root(E1&& x, E2&& y)
+CMT_FUNC internal::expression_function<fn::root, E1, E2> root(E1&& x, E2&& y)
{
return { fn::root(), std::forward<E1>(x), std::forward<E2>(y) };
}
template <typename T1, KFR_ENABLE_IF(is_numeric<T1>::value)>
-KFR_INTRIN flt_type<T1> cbrt(const T1& x)
+CMT_FUNC flt_type<T1> cbrt(const T1& x)
{
return intrinsics::cbrt(x);
}
template <typename E1, KFR_ENABLE_IF(is_input_expression<E1>::value)>
-KFR_INTRIN internal::expression_function<fn::cbrt, E1> cbrt(E1&& x)
+CMT_FUNC internal::expression_function<fn::cbrt, E1> cbrt(E1&& x)
{
return { fn::cbrt(), std::forward<E1>(x) };
}
diff --git a/include/kfr/base/modzerobessel.hpp b/include/kfr/base/modzerobessel.hpp
@@ -100,13 +100,13 @@ KFR_I_CONVERTER(modzerobessel)
KFR_I_FN(modzerobessel)
template <typename T1, KFR_ENABLE_IF(is_numeric<T1>::value)>
-KFR_INTRIN T1 modzerobessel(const T1& x)
+CMT_FUNC T1 modzerobessel(const T1& x)
{
return intrinsics::modzerobessel(x);
}
template <typename E1, KFR_ENABLE_IF(is_input_expression<E1>::value)>
-KFR_INTRIN internal::expression_function<fn::modzerobessel, E1> modzerobessel(E1&& x)
+CMT_FUNC internal::expression_function<fn::modzerobessel, E1> modzerobessel(E1&& x)
{
return { fn::modzerobessel(), std::forward<E1>(x) };
}