1 | /* Copyright (C) 2013-2014 Povilas Kanapickas <povilas@radix.lt> |
2 | |
3 | Distributed under the Boost Software License, Version 1.0. |
4 | (See accompanying file LICENSE_1_0.txt or copy at |
5 | http://www.boost.org/LICENSE_1_0.txt) |
6 | */ |
7 | |
8 | #ifndef LIBSIMDPP_SIMDPP_DETAIL_EXPR_BLEND_H |
9 | #define LIBSIMDPP_SIMDPP_DETAIL_EXPR_BLEND_H |
10 | |
11 | #ifndef LIBSIMDPP_SIMD_H |
12 | #error "This file must be included through simd.h" |
13 | #endif |
14 | |
15 | #include <simdpp/types.h> |
16 | #include <simdpp/core/blend.h> |
17 | #include <simdpp/detail/insn/blend.h> |
18 | |
19 | namespace simdpp { |
20 | namespace SIMDPP_ARCH_NAMESPACE { |
21 | namespace detail { |
22 | |
23 | template<class R, class E1, class E2, class E3> |
24 | struct expr_eval<R, expr_blend<E1, E2, E3>> { |
25 | static SIMDPP_INL R eval(const expr_blend<E1, E2, E3>& e) |
26 | { |
27 | using E = get_expr_blend<E1, E2, E3>; |
28 | return (R) insn::i_blend( |
29 | eval_maybe_scalar<typename E::v1_final_type, E1>::eval(e.on), |
30 | eval_maybe_scalar<typename E::v2_final_type, E2>::eval(e.off), |
31 | eval_maybe_scalar<typename E::v3_final_type, E3>::eval(e.mask)); |
32 | } |
33 | }; |
34 | |
35 | |
36 | } // namespace detail |
37 | } // namespace SIMDPP_ARCH_NAMESPACE |
38 | } // namespace simdpp |
39 | |
40 | #endif |
41 | |
42 | |