commit 81adbe8331562db30d73003d2ed0dbd9d1df32c8
parent b05fdecc29a98527ab933b8b1ae293af8d8c71fc
Author: [email protected] <[email protected]>
Date: Sun, 7 Aug 2016 07:18:32 +0300
add reverse function for vec<vec<>>
Diffstat:
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/include/kfr/base/shuffle.hpp b/include/kfr/base/shuffle.hpp
@@ -376,11 +376,11 @@ struct shuffle_index_outputright
}
template <size_t elements, typename T, size_t N>
-KFR_INLINE vec<T, N> swap(vec<T, N> x)
+KFR_INLINE vec<T, N> swap(const vec<T, N>& x)
{
return shufflevector<N, internal::shuffle_index_swap<elements>>(x);
}
-KFR_FN(swap)
+CMT_FN_TPL((size_t elements), (elements), swap)
template <size_t shift, typename T, size_t N>
KFR_INLINE vec<T, N> rotatetwo(const vec<T, N>& lo, const vec<T, N>& hi)
@@ -520,6 +520,11 @@ KFR_INLINE vec<T, N> reverse(const vec<T, N>& x)
{
return shufflevector<N, internal::shuffle_index_reverse<N / groupsize>, groupsize>(x);
}
+template <typename T, size_t N1, size_t N2>
+KFR_INLINE vec<vec<T, N1>, N2> reverse(const vec<vec<T, N1>, N2>& x)
+{
+ return *swap<N1>(flatten(x));
+}
KFR_FN(reverse)
namespace internal