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_CORE_BIT_NOT_H |
9 | #define LIBSIMDPP_SIMDPP_CORE_BIT_NOT_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/detail/insn/bit_not.h> |
17 | #include <simdpp/detail/expr/bit_not.h> |
18 | #include <simdpp/detail/get_expr.h> |
19 | |
20 | namespace simdpp { |
21 | namespace SIMDPP_ARCH_NAMESPACE { |
22 | |
23 | /** Computes bitwise NOT of an integer or floating-point vector |
24 | |
25 | @code |
26 | r = ~a |
27 | @endcode |
28 | |
29 | @todo icost |
30 | */ |
31 | template<unsigned N, class V> SIMDPP_INL |
32 | typename detail::get_expr<V, expr_bit_not<V>>::empty |
33 | bit_not(const any_vec<N,V>& a) |
34 | { |
35 | typename detail::get_expr_nosign<V>::type ra; |
36 | ra = a.wrapped().eval(); |
37 | return detail::insn::i_bit_not(ra); |
38 | } |
39 | |
40 | /* FIXME |
41 | template<unsigned N, class E> SIMDPP_INL |
42 | mask_int32<N, expr_bit_not<mask_int32<N,E>>> bit_not(mask_int32<N,E> a) |
43 | { |
44 | return { { a } }; |
45 | } |
46 | template<unsigned N, class E> SIMDPP_INL |
47 | mask_int64<N, expr_bit_not<mask_int64<N,E>>> bit_not(mask_int64<N,E> a) |
48 | { |
49 | return { { a } }; |
50 | } |
51 | |
52 | template<unsigned N, class E> SIMDPP_INL |
53 | mask_float32<N, expr_bit_not<mask_float32<N,E>>> bit_not(mask_float32<N,E> a) |
54 | { |
55 | return { { a } }; |
56 | } |
57 | template<unsigned N, class E> SIMDPP_INL |
58 | mask_float64<N, expr_bit_not<mask_float64<N,E>>> bit_not(mask_float64<N,E> a) |
59 | { |
60 | return { { a } }; |
61 | } |
62 | */ |
63 | |
64 | } // namespace SIMDPP_ARCH_NAMESPACE |
65 | } // namespace simdpp |
66 | |
67 | #endif |
68 | |
69 | |