commit cddc7e632f2dde1c6b76fa0b7525761d35f19ca9
parent 4f58faa60bc45a02915b57c77e9e41e6c2950e14
Author: d.levin256@gmail.com <d.levin256@gmail.com>
Date: Tue, 4 Apr 2017 02:37:43 +0300
Macro for right/left shift
Diffstat:
1 file changed, 12 insertions(+), 0 deletions(-)
diff --git a/include/kfr/base/function.hpp b/include/kfr/base/function.hpp
@@ -203,6 +203,18 @@ KFR_SINTRIN vec<T, Nout> expand_simd(const vec<T, N>& x, identity<T> value)
return concat(fn(low(a), low(b)), fn(high(a), high(b))); \
}
+#define KFR_HANDLE_ALL_SIZES_2_INT(fn) \
+ template <typename T, size_t N, KFR_ENABLE_IF(N < platform<T>::vector_width)> \
+ KFR_SINTRIN vec<T, N> fn(const vec<T, N>& a, int b) \
+ { \
+ return slice<0, N>(fn(expand_simd(a), b)); \
+ } \
+ template <typename T, size_t N, KFR_ENABLE_IF(N >= platform<T>::vector_width), typename = void> \
+ KFR_SINTRIN vec<T, N> fn(const vec<T, N>& a, int b) \
+ { \
+ return concat(fn(low(a), b), fn(high(a), b)); \
+ }
+
#define KFR_HANDLE_ALL_SIZES_3(fn) \
template <typename T, size_t N, KFR_ENABLE_IF(N < platform<T>::vector_width)> \
KFR_SINTRIN vec<T, N> fn(const vec<T, N>& a, const vec<T, N>& b, const vec<T, N>& c) \