commit 2866cbfa078f96150fbce6ff92a0d1b15b90e685
parent a27857b7706c296f954d224c4d221a0c3988621d
Author: [email protected] <[email protected]>
Date: Thu, 8 Sep 2016 17:28:06 +0300
Macro refactoring
Diffstat:
13 files changed, 104 insertions(+), 129 deletions(-)
diff --git a/include/kfr/base/complex.hpp b/include/kfr/base/complex.hpp
@@ -272,7 +272,7 @@ using realftype = ftype<decltype(kfr::real(std::declval<T>()))>;
KFR_FN(real)
template <typename E1, KFR_ENABLE_IF(is_input_expression<E1>::value)>
-CMT_INLINE internal::expression_function<fn_real, E1> real(E1&& x)
+CMT_INLINE internal::expression_function<fn::real, E1> real(E1&& x)
{
return { {}, std::forward<E1>(x) };
}
@@ -289,7 +289,7 @@ constexpr CMT_INLINE vec<T, N> imag(const vec<complex<T>, N>& value)
}
KFR_FN(imag)
template <typename E1, KFR_ENABLE_IF(is_input_expression<E1>::value)>
-CMT_INLINE internal::expression_function<fn_imag, E1> imag(E1&& x)
+CMT_INLINE internal::expression_function<fn::imag, E1> imag(E1&& x)
{
return { {}, std::forward<E1>(x) };
}
diff --git a/include/kfr/base/expression.hpp b/include/kfr/base/expression.hpp
@@ -25,9 +25,9 @@
*/
#pragma once
+#include "platform.hpp"
#include "types.hpp"
#include "vec.hpp"
-#include "platform.hpp"
#include <tuple>
diff --git a/include/kfr/base/operators.hpp b/include/kfr/base/operators.hpp
@@ -84,9 +84,9 @@ KFR_FN(add)
* @brief Returns template expression that returns sum of all the arguments passed to a function.
*/
template <typename... E, KFR_ENABLE_IF(is_input_expressions<E...>::value)>
-CMT_INLINE internal::expression_function<fn_add, E...> add(E&&... x)
+CMT_INLINE internal::expression_function<fn::add, E...> add(E&&... x)
{
- return { fn_add(), std::forward<E>(x)... };
+ return { fn::add(), std::forward<E>(x)... };
}
template <typename T1, typename T2>
@@ -102,9 +102,9 @@ constexpr inline T sub(initialvalue<T>)
KFR_FN(sub)
template <typename E1, typename E2, KFR_ENABLE_IF(is_input_expressions<E1, E2>::value)>
-CMT_INLINE internal::expression_function<fn_sub, E1, E2> sub(E1&& x, E2&& y)
+CMT_INLINE internal::expression_function<fn::sub, E1, E2> sub(E1&& x, E2&& y)
{
- return { fn_sub(), std::forward<E1>(x), std::forward<E2>(y) };
+ return { fn::sub(), std::forward<E1>(x), std::forward<E2>(y) };
}
template <typename T1>
@@ -133,14 +133,14 @@ KFR_FN(mul)
* @brief Returns template expression that returns product of all the arguments passed to a function.
*/
template <typename E1, typename E2, KFR_ENABLE_IF(is_input_expressions<E1, E2>::value)>
-CMT_INLINE internal::expression_function<fn_mul, E1, E2> mul(E1&& x, E2&& y)
+CMT_INLINE internal::expression_function<fn::mul, E1, E2> mul(E1&& x, E2&& y)
{
- return { fn_mul(), std::forward<E1>(x), std::forward<E2>(y) };
+ return { fn::mul(), std::forward<E1>(x), std::forward<E2>(y) };
}
template <typename E1, typename E2, typename E3, KFR_ENABLE_IF(is_input_expressions<E1, E2>::value)>
-CMT_INLINE internal::expression_function<fn_mul, E1> mul(E1&& x, E2&& y, E3&& z)
+CMT_INLINE internal::expression_function<fn::mul, E1> mul(E1&& x, E2&& y, E3&& z)
{
- return { fn_mul(), std::forward<E1>(x), std::forward<E2>(y), std::forward<E3>(z) };
+ return { fn::mul(), std::forward<E1>(x), std::forward<E2>(y), std::forward<E3>(z) };
}
/**
@@ -157,9 +157,9 @@ KFR_FN(sqr)
* @brief Returns template expression that returns square of x.
*/
template <typename E1, KFR_ENABLE_IF(is_input_expression<E1>::value)>
-CMT_INLINE internal::expression_function<fn_sqr, E1> sqr(E1&& x)
+CMT_INLINE internal::expression_function<fn::sqr, E1> sqr(E1&& x)
{
- return { fn_sqr(), std::forward<E1>(x) };
+ return { fn::sqr(), std::forward<E1>(x) };
}
/**
@@ -176,9 +176,9 @@ KFR_FN(cub)
* @brief Returns template expression that returns cube of x.
*/
template <typename E1, KFR_ENABLE_IF(is_input_expression<E1>::value)>
-CMT_INLINE internal::expression_function<fn_cub, E1> cub(E1&& x)
+CMT_INLINE internal::expression_function<fn::cub, E1> cub(E1&& x)
{
- return { fn_cub(), std::forward<E1>(x) };
+ return { fn::cub(), std::forward<E1>(x) };
}
template <typename T, KFR_ENABLE_IF(is_numeric_args<T>::value)>
@@ -210,24 +210,24 @@ KFR_FN(pow4)
KFR_FN(pow5)
template <typename E1, KFR_ENABLE_IF(is_input_expression<E1>::value)>
-CMT_INLINE internal::expression_function<fn_pow2, E1> pow2(E1&& x)
+CMT_INLINE internal::expression_function<fn::pow2, E1> pow2(E1&& x)
{
- return { fn_pow2(), std::forward<E1>(x) };
+ return { fn::pow2(), std::forward<E1>(x) };
}
template <typename E1, KFR_ENABLE_IF(is_input_expression<E1>::value)>
-CMT_INLINE internal::expression_function<fn_pow3, E1> pow3(E1&& x)
+CMT_INLINE internal::expression_function<fn::pow3, E1> pow3(E1&& x)
{
- return { fn_pow3(), std::forward<E1>(x) };
+ return { fn::pow3(), std::forward<E1>(x) };
}
template <typename E1, KFR_ENABLE_IF(is_input_expression<E1>::value)>
-CMT_INLINE internal::expression_function<fn_pow4, E1> pow4(E1&& x)
+CMT_INLINE internal::expression_function<fn::pow4, E1> pow4(E1&& x)
{
- return { fn_pow4(), std::forward<E1>(x) };
+ return { fn::pow4(), std::forward<E1>(x) };
}
template <typename E1, KFR_ENABLE_IF(is_input_expression<E1>::value)>
-CMT_INLINE internal::expression_function<fn_pow5, E1> pow5(E1&& x)
+CMT_INLINE internal::expression_function<fn::pow5, E1> pow5(E1&& x)
{
- return { fn_pow5(), std::forward<E1>(x) };
+ return { fn::pow5(), std::forward<E1>(x) };
}
/// Raise x to the power base \f$ x^{base} \f$
@@ -251,9 +251,9 @@ constexpr inline T ipow(T x, int base)
KFR_FN(ipow)
template <typename E1, typename E2, KFR_ENABLE_IF(is_input_expressions<E1, E2>::value)>
-CMT_INLINE internal::expression_function<fn_ipow, E1, E2> ipow(E1&& x, E2&& b)
+CMT_INLINE internal::expression_function<fn::ipow, E1, E2> ipow(E1&& x, E2&& b)
{
- return { fn_ipow(), std::forward<E1>(x), std::forward<E2>(b) };
+ return { fn::ipow(), std::forward<E1>(x), std::forward<E2>(b) };
}
/// Return square of the sum of all arguments
@@ -495,12 +495,11 @@ constexpr CMT_INLINE T reciprocal(T x)
}
KFR_FN(reciprocal)
-template <typename T, size_t N>
-CMT_INLINE vec<T, N> mulsign(const vec<T, N>& x, const vec<T, N>& y)
+template <typename T1, typename T2>
+CMT_INLINE common_type<T1, T2> mulsign(const T1& x, const T2& y)
{
- return x ^ (y & internal::highbitmask<T>);
+ return x ^ (y & internal::highbitmask<subtype<T2>>);
}
-KFR_FN_S(mulsign)
KFR_FN(mulsign)
template <typename T, size_t N>
@@ -572,7 +571,7 @@ KFR_FN(swapbyteorder)
template <typename T, size_t N>
CMT_INLINE T hadd(const vec<T, N>& value)
{
- return horizontal(value, fn_add());
+ return horizontal(value, fn::add());
}
KFR_FN(hadd)
@@ -580,26 +579,26 @@ KFR_FN(hadd)
template <typename T, size_t N>
CMT_INLINE T hmul(const vec<T, N>& value)
{
- return horizontal(value, fn_mul());
+ return horizontal(value, fn::mul());
}
KFR_FN(hmul)
template <typename T, size_t N>
CMT_INLINE T hbitwiseand(const vec<T, N>& value)
{
- return horizontal(value, fn_bitwiseand());
+ return horizontal(value, fn::bitwiseand());
}
KFR_FN(hbitwiseand)
template <typename T, size_t N>
CMT_INLINE T hbitwiseor(const vec<T, N>& value)
{
- return horizontal(value, fn_bitwiseor());
+ return horizontal(value, fn::bitwiseor());
}
KFR_FN(hbitwiseor)
template <typename T, size_t N>
CMT_INLINE T hbitwisexor(const vec<T, N>& value)
{
- return horizontal(value, fn_bitwisexor());
+ return horizontal(value, fn::bitwisexor());
}
KFR_FN(hbitwisexor)
@@ -666,25 +665,25 @@ CMT_INLINE vec<T, N> negodd(const vec<T, N>& x)
return bind_expression(fn(), std::forward<A1>(a1), std::forward<A2>(a2)); \
}
-KFR_EXPR_UNARY(fn_neg, -)
-KFR_EXPR_UNARY(fn_bitwisenot, ~)
-
-KFR_EXPR_BINARY(fn_add, +)
-KFR_EXPR_BINARY(fn_sub, -)
-KFR_EXPR_BINARY(fn_mul, *)
-KFR_EXPR_BINARY(fn_div, /)
-KFR_EXPR_BINARY(fn_bitwiseand, &)
-KFR_EXPR_BINARY(fn_bitwiseor, |)
-KFR_EXPR_BINARY(fn_bitwisexor, ^)
-KFR_EXPR_BINARY(fn_shl, <<)
-KFR_EXPR_BINARY(fn_shr, >>)
-
-KFR_EXPR_BINARY(fn_equal, ==)
-KFR_EXPR_BINARY(fn_notequal, !=)
-KFR_EXPR_BINARY(fn_less, <)
-KFR_EXPR_BINARY(fn_greater, >)
-KFR_EXPR_BINARY(fn_lessorequal, <=)
-KFR_EXPR_BINARY(fn_greaterorequal, >=)
+KFR_EXPR_UNARY(fn::neg, -)
+KFR_EXPR_UNARY(fn::bitwisenot, ~)
+
+KFR_EXPR_BINARY(fn::add, +)
+KFR_EXPR_BINARY(fn::sub, -)
+KFR_EXPR_BINARY(fn::mul, *)
+KFR_EXPR_BINARY(fn::div, /)
+KFR_EXPR_BINARY(fn::bitwiseand, &)
+KFR_EXPR_BINARY(fn::bitwiseor, |)
+KFR_EXPR_BINARY(fn::bitwisexor, ^)
+KFR_EXPR_BINARY(fn::shl, <<)
+KFR_EXPR_BINARY(fn::shr, >>)
+
+KFR_EXPR_BINARY(fn::equal, ==)
+KFR_EXPR_BINARY(fn::notequal, !=)
+KFR_EXPR_BINARY(fn::less, <)
+KFR_EXPR_BINARY(fn::greater, >)
+KFR_EXPR_BINARY(fn::lessorequal, <=)
+KFR_EXPR_BINARY(fn::greaterorequal, >=)
#undef KFR_EXPR_UNARY
#undef KFR_EXPR_BINARY
@@ -713,7 +712,7 @@ struct expression_pack : expression<E...>, output_expression
template <size_t N>
CMT_INLINE vec<T, N> operator()(cinput_t, size_t index, vec_t<T, N> y) const
{
- return this->call(fn_packtranspose(), index, y);
+ return this->call(fn::packtranspose(), index, y);
}
};
diff --git a/include/kfr/base/reduce.hpp b/include/kfr/base/reduce.hpp
@@ -106,14 +106,15 @@ protected:
FinalFn finalfn;
mutable vec<T, width> value;
};
+}
-template <typename ReduceFn, typename TransformFn = fn_pass_through, typename FinalFn = fn_pass_through,
+template <typename ReduceFn, typename TransformFn = fn::pass_through, typename FinalFn = fn::pass_through,
typename E1, typename T = value_type_of<E1>>
-KFR_SINTRIN T reduce(E1&& e1, ReduceFn&& reducefn, TransformFn&& transformfn = fn_pass_through(),
- FinalFn&& finalfn = fn_pass_through())
+KFR_SINTRIN T reduce(E1&& e1, ReduceFn&& reducefn, TransformFn&& transformfn = fn::pass_through(),
+ FinalFn&& finalfn = fn::pass_through())
{
static_assert(!is_infinite<E1>::value, "e1 must be a sized expression (use slice())");
- using reducer_t = expression_reduce<T, decay<ReduceFn>, decay<TransformFn>, decay<FinalFn>>;
+ using reducer_t = internal::expression_reduce<T, decay<ReduceFn>, decay<TransformFn>, decay<FinalFn>>;
reducer_t red(std::forward<ReduceFn>(reducefn), std::forward<TransformFn>(transformfn),
std::forward<FinalFn>(finalfn));
process<T>(red, std::forward<E1>(e1));
@@ -122,7 +123,6 @@ KFR_SINTRIN T reduce(E1&& e1, ReduceFn&& reducefn, TransformFn&& transformfn = f
}
KFR_FN(reduce)
-}
/**
* @brief Returns the sum of all the elements in x.
@@ -136,7 +136,7 @@ template <typename E1, typename T = value_type_of<E1>, KFR_ENABLE_IF(is_input_ex
KFR_SINTRIN T sum(E1&& x)
{
static_assert(!is_infinite<E1>::value, "e1 must be a sized expression (use slice())");
- return internal::reduce(std::forward<E1>(x), fn_add());
+ return reduce(std::forward<E1>(x), fn::add());
}
/**
@@ -151,7 +151,7 @@ template <typename E1, typename T = value_type_of<E1>, KFR_ENABLE_IF(is_input_ex
KFR_SINTRIN T mean(E1&& x)
{
static_assert(!is_infinite<E1>::value, "e1 must be a sized expression (use slice())");
- return internal::reduce(std::forward<E1>(x), fn_add(), fn_pass_through(), fn_final_mean());
+ return reduce(std::forward<E1>(x), fn::add(), fn::pass_through(), fn::final_mean());
}
/**
@@ -163,7 +163,7 @@ template <typename E1, typename T = value_type_of<E1>, KFR_ENABLE_IF(is_input_ex
KFR_SINTRIN T minof(E1&& x)
{
static_assert(!is_infinite<E1>::value, "e1 must be a sized expression (use slice())");
- return internal::reduce(std::forward<E1>(x), fn::min());
+ return reduce(std::forward<E1>(x), fn::min());
}
/**
@@ -175,7 +175,7 @@ template <typename E1, typename T = value_type_of<E1>, KFR_ENABLE_IF(is_input_ex
KFR_SINTRIN T maxof(E1&& x)
{
static_assert(!is_infinite<E1>::value, "e1 must be a sized expression (use slice())");
- return internal::reduce(std::forward<E1>(x), fn::max());
+ return reduce(std::forward<E1>(x), fn::max());
}
/**
@@ -187,7 +187,7 @@ template <typename E1, typename T = value_type_of<E1>, KFR_ENABLE_IF(is_input_ex
KFR_SINTRIN T absminof(E1&& x)
{
static_assert(!is_infinite<E1>::value, "e1 must be a sized expression (use slice())");
- return internal::reduce(std::forward<E1>(x), fn::absmin());
+ return reduce(std::forward<E1>(x), fn::absmin());
}
/**
@@ -199,7 +199,7 @@ template <typename E1, typename T = value_type_of<E1>, KFR_ENABLE_IF(is_input_ex
KFR_SINTRIN T absmaxof(E1&& x)
{
static_assert(!is_infinite<E1>::value, "e1 must be a sized expression (use slice())");
- return internal::reduce(std::forward<E1>(x), fn::absmax());
+ return reduce(std::forward<E1>(x), fn::absmax());
}
/**
@@ -217,7 +217,7 @@ KFR_SINTRIN T dotproduct(E1&& x, E2&& y)
auto m = std::forward<E1>(x) * std::forward<E2>(y);
using E12 = decltype(m);
static_assert(!is_infinite<E12>::value, "e1 must be a sized expression (use slice())");
- return internal::reduce(std::move(m), fn_add());
+ return reduce(std::move(m), fn::add());
}
/**
@@ -232,7 +232,7 @@ template <typename E1, typename T = value_type_of<E1>, KFR_ENABLE_IF(is_input_ex
KFR_SINTRIN T rms(E1&& x)
{
static_assert(!is_infinite<E1>::value, "e1 must be a sized expression (use slice())");
- return internal::reduce(std::forward<E1>(x), fn_add(), fn_sqr(), fn_final_rootmean());
+ return reduce(std::forward<E1>(x), fn::add(), fn::sqr(), fn::final_rootmean());
}
/**
@@ -247,7 +247,7 @@ template <typename E1, typename T = value_type_of<E1>, KFR_ENABLE_IF(is_input_ex
KFR_SINTRIN T sumsqr(E1&& x)
{
static_assert(!is_infinite<E1>::value, "e1 must be a sized expression (use slice())");
- return internal::reduce(std::forward<E1>(x), fn_add(), fn_sqr());
+ return reduce(std::forward<E1>(x), fn::add(), fn::sqr());
}
/**
@@ -262,6 +262,6 @@ template <typename E1, typename T = value_type_of<E1>, KFR_ENABLE_IF(is_input_ex
KFR_SINTRIN T product(E1&& x)
{
static_assert(!is_infinite<E1>::value, "e1 must be a sized expression (use slice())");
- return internal::reduce(std::forward<E1>(x), fn_mul());
+ return reduce(std::forward<E1>(x), fn::mul());
}
}
diff --git a/include/kfr/base/round.hpp b/include/kfr/base/round.hpp
@@ -322,13 +322,11 @@ KFR_INTRIN internal::expression_function<fn::itrunc, E1> itrunc(E1&& x)
return { fn::itrunc(), std::forward<E1>(x) };
}
-template <typename T, size_t N, KFR_ENABLE_IF(is_f_class<T>::value)>
-CMT_INLINE vec<T, N> fmod(const vec<T, N>& x, const vec<T, N>& y)
+template <typename T, KFR_ENABLE_IF(is_f_class<T>::value)>
+CMT_INLINE T fmod(const T& x, const T& y)
{
return x - trunc(x / y) * y;
}
-
-KFR_FN_S(fmod)
KFR_FN(fmod)
template <typename T, size_t N, KFR_ENABLE_IF(!is_f_class<T>::value)>
diff --git a/include/kfr/base/shuffle.hpp b/include/kfr/base/shuffle.hpp
@@ -159,7 +159,7 @@ CMT_INLINE vec<T, Nout> even(const vec<T, N>& x)
{
return shufflevector<Nout, internal::shuffle_index<0, 2>, groupsize>(x);
}
-KFR_FNR(even, 2, 1)
+KFR_FN(even)
template <size_t groupsize = 1, typename T, size_t N, size_t Nout = N / 2,
KFR_ENABLE_IF(N >= 2 && (N & 1) == 0)>
@@ -167,7 +167,7 @@ CMT_INLINE vec<T, Nout> odd(const vec<T, N>& x)
{
return shufflevector<Nout, internal::shuffle_index<1, 2>, groupsize>(x);
}
-KFR_FNR(odd, 2, 1)
+KFR_FN(odd)
namespace internal
{
@@ -307,7 +307,7 @@ CMT_INLINE vec<T, Nout> dup(const vec<T, N>& x)
{
return shufflevector<Nout, internal::shuffle_index_dup1<2>>(x, x);
}
-KFR_FNR(dup, 1, 2)
+KFR_FN(dup)
namespace internal
{
@@ -491,12 +491,12 @@ CMT_INLINE vec<T, Nout> interleave(const vec<T, N>& x, const vec<T, N>& y)
return shufflevector<Nout, internal::shuffle_index_transpose<Nout / groupsize, Nout / groupsize / 2>,
groupsize>(x, y);
}
-KFR_FNR(interleave, 1, 2)
+KFR_FN(interleave)
template <typename E1, typename E2, KFR_ENABLE_IF(is_input_expressions<E1, E2>::value)>
-CMT_INLINE internal::expression_function<fn_interleave, E1, E2> interleave(E1&& x, E2&& y)
+CMT_INLINE internal::expression_function<fn::interleave, E1, E2> interleave(E1&& x, E2&& y)
{
- return { fn_interleave(), std::forward<E1>(x), std::forward<E2>(y) };
+ return { fn::interleave(), std::forward<E1>(x), std::forward<E2>(y) };
}
template <size_t groupsize = 1, typename T, size_t N>
diff --git a/include/kfr/base/types.hpp b/include/kfr/base/types.hpp
@@ -37,15 +37,18 @@
#define KFR_ENABLE_IF CMT_ENABLE_IF
-#define KFR_FN(fn) \
- struct fn_##fn \
+#define KFR_FN(FN) \
+ namespace fn \
+ { \
+ struct FN \
{ \
template <typename... Args> \
- CMT_INLINE_MEMBER decltype(fn(std::declval<Args>()...)) operator()(Args&&... args) const \
+ CMT_INLINE_MEMBER decltype(::kfr::FN(std::declval<Args>()...)) operator()(Args&&... args) const \
{ \
- return fn(std::forward<Args>(args)...); \
+ return ::kfr::FN(std::forward<Args>(args)...); \
} \
- };
+ }; \
+ }
#define KFR_I_FN(FN) \
namespace fn \
@@ -61,27 +64,6 @@
}; \
}
-#define KFR_FNR(fn, in, out) \
- struct fn_##fn \
- { \
- template <typename... Args> \
- CMT_INLINE_MEMBER decltype(fn(std::declval<Args>()...)) operator()(Args&&... args) const \
- { \
- return fn(std::forward<Args>(args)...); \
- } \
- };
-
-#define KFR_SPEC_FN(tpl, fn) \
- struct fn_##fn \
- { \
- constexpr fn_##fn() noexcept = default; \
- template <typename... Args> \
- CMT_INLINE decltype(fn(std::declval<Args>()...)) operator()(Args&&... args) const \
- { \
- return fn(std::forward<Args>(args)...); \
- } \
- };
-
namespace kfr
{
using namespace cometa;
@@ -269,6 +251,18 @@ struct typebits
using subtype = typename compound_type_traits<T>::subtype;
};
+namespace fn
+{
+using pass_through = cometa::fn_pass_through;
+using noop = cometa::fn_noop;
+using get_first = cometa::fn_get_first;
+using get_second = cometa::fn_get_second;
+using get_third = cometa::fn_get_third;
+
+template <typename T>
+using returns = cometa::fn_returns<T>;
+}
+
namespace internal
{
template <size_t bits>
@@ -466,19 +460,6 @@ CMT_INLINE constexpr static T implicit_cast(U&& value)
#pragma clang diagnostic pop
-#define KFR_FN_S(fn) \
- template <typename Arg, typename... Args> \
- CMT_INLINE enable_if_not_vec<Arg> fn(Arg arg, Args... args) \
- { \
- return fn(make_vector(arg), make_vector(args)...)[0]; \
- }
-#define KFR_FN_S_S(fn) \
- template <typename Arg, typename... Args, KFR_ENABLE_IF(is_number<Arg>::value)> \
- KFR_SINTRIN enable_if_not_vec<Arg> fn(Arg arg, Args... args) \
- { \
- return fn(make_vector(arg), make_vector(args)...)[0]; \
- }
-
template <typename T>
struct initialvalue
{
diff --git a/include/kfr/cometa/function.hpp b/include/kfr/cometa/function.hpp
@@ -129,14 +129,14 @@ private:
details::virtual_function<Result, Args...>* fn;
};
-template <typename Ret, typename... Args, typename T, typename Fn, typename DefFn = fn_noop>
+template <typename Ret, typename... Args, typename T, typename Fn, typename DefFn = fn::noop>
CMT_INLINE function<Ret(Args...)> cdispatch(cvals_t<T>, identity<T>, Fn&&, DefFn&& deffn = DefFn())
{
return [=](Args... args) CMT_INLINE_MEMBER -> Ret { return deffn(std::forward<Args>(args)...); };
}
template <typename Ret, typename... Args, typename T, T v0, T... values, typename Fn,
- typename DefFn = fn_noop>
+ typename DefFn = fn::noop>
inline function<Ret(Args...)> cdispatch(cvals_t<T, v0, values...>, identity<T> value, Fn&& fn,
DefFn&& deffn = DefFn())
{
diff --git a/include/kfr/dft/ft.hpp b/include/kfr/dft/ft.hpp
@@ -67,7 +67,6 @@ CMT_INLINE vec<T, const_max(N1, N2)> cmul(vec<T, N1> x, vec<T, N2> y)
{
return internal::cmul_impl(x, y);
}
-KFR_FN(cmul)
template <typename T, size_t N, KFR_ENABLE_IF(N >= 2)>
CMT_INLINE vec<T, N> cmul_conj(vec<T, N> x, vec<T, N> y)
@@ -103,8 +102,6 @@ CMT_INLINE vec<T, N> cmul_conj(vec<T, 2> x, vec<T, N> y)
vec<T, N> xx = resize<N>(x);
return cmul_conj(xx, y);
}
-KFR_FN(cmul_conj)
-KFR_FN(cmul_2conj)
template <typename T, size_t N>
using cvec = vec<T, N * 2>;
diff --git a/include/kfr/dsp/mixdown.hpp b/include/kfr/dsp/mixdown.hpp
@@ -33,9 +33,9 @@ namespace kfr
* @brief Returns template expression that returns the sum of all the inputs
*/
template <typename... E>
-internal::expression_function<fn_add, E...> mixdown(E&&... e)
+internal::expression_function<fn::add, E...> mixdown(E&&... e)
{
- return internal::expression_function<fn_add, E...>(fn_add(), std::forward<E>(e)...);
+ return internal::expression_function<fn::add, E...>(fn::add(), std::forward<E>(e)...);
}
namespace internal
diff --git a/include/kfr/dsp/window.hpp b/include/kfr/dsp/window.hpp
@@ -614,6 +614,6 @@ CMT_NOINLINE expression_pointer<T> window(size_t size, window_type type, identit
return to_pointer<T>(
typename internal::window_by_type<window>::template type<T>(size, win_param, symmetry));
},
- fn_returns<expression_pointer<T>>());
+ fn::returns<expression_pointer<T>>());
}
}
diff --git a/tests/base_test.cpp b/tests/base_test.cpp
@@ -142,7 +142,7 @@ TEST(vec_make_vector)
TEST(vec_apply)
{
CHECK(apply([](int x) { return x + 1; }, make_vector(1, 2, 3, 4, 5)) == make_vector(2, 3, 4, 5, 6));
- CHECK(apply(fn_sqr(), make_vector(1, 2, 3, 4, 5)) == make_vector(1, 4, 9, 16, 25));
+ CHECK(apply(fn::sqr(), make_vector(1, 2, 3, 4, 5)) == make_vector(1, 4, 9, 16, 25));
}
TEST(vec_zerovector)
diff --git a/tests/expression_test.cpp b/tests/expression_test.cpp
@@ -22,7 +22,7 @@ TEST(pack)
CHECK(v3[18] == f32x2{ 19, 209 });
CHECK(v3[19] == f32x2{ 20, 220 });
- const univector<f32x2, 20> v4 = bind_expression(fn_reverse(), v3);
+ const univector<f32x2, 20> v4 = bind_expression(fn::reverse(), v3);
CHECK(v4[0] == f32x2{ 11, 1 });
CHECK(v4[1] == f32x2{ 22, 2 });
CHECK(v4[18] == f32x2{ 209, 19 });
@@ -31,7 +31,7 @@ TEST(pack)
TEST(adjacent)
{
- univector<int, 20> v1 = adjacent(fn_mul(), counter());
+ univector<int, 20> v1 = adjacent(fn::mul(), counter());
CHECK(v1[0] == 0);
CHECK(v1[1] == 0);
CHECK(v1[2] == 2);