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_BIT_AND_H |
9 | #define LIBSIMDPP_SIMDPP_DETAIL_EXPR_BIT_AND_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/detail/get_expr_bitwise.h> |
17 | #include <simdpp/detail/insn/bit_and.h> |
18 | #include <simdpp/detail/eval_scalar.h> |
19 | |
20 | namespace simdpp { |
21 | namespace SIMDPP_ARCH_NAMESPACE { |
22 | namespace detail { |
23 | |
24 | template<class R, class E1, class E2> |
25 | struct expr_eval<R, expr_bit_and<E1, E2>> { |
26 | static SIMDPP_INL R eval(const expr_bit_and<E1, E2>& e) |
27 | { |
28 | using E = get_expr_bitwise2_and_impl<E1, E2>; |
29 | return (R) insn::i_bit_and( |
30 | eval_maybe_scalar_bitwise<typename E::v1_final_type, E1>::eval(e.a), |
31 | eval_maybe_scalar_bitwise<typename E::v2_final_type, E2>::eval(e.b)); |
32 | } |
33 | }; |
34 | |
35 | } // namespace detail |
36 | } // namespace SIMDPP_ARCH_NAMESPACE |
37 | } // namespace simdpp |
38 | |
39 | #endif |
40 | |