1 | /* Copyright (C) 2016 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_SIMD_CORE_TEST_BITS_H |
9 | #define LIBSIMDPP_SIMD_CORE_TEST_BITS_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/expr/test_bits.h> |
17 | #include <simdpp/detail/get_expr.h> |
18 | |
19 | namespace simdpp { |
20 | namespace SIMDPP_ARCH_NAMESPACE { |
21 | |
22 | /** Returns true if any bits are set in the given vector. |
23 | */ |
24 | template<unsigned N, class V> SIMDPP_INL |
25 | bool test_bits_any(const any_vec<N,V>& a) |
26 | { |
27 | static_assert(!is_mask<V>::value, "Mask types are not supported" ); |
28 | using expr = typename detail::get_expr_nosign<V, typename V::expr_type>::type; |
29 | return detail::e_test_bits_any(expr(a)); |
30 | } |
31 | |
32 | |
33 | } // namespace SIMDPP_ARCH_NAMESPACE |
34 | } // namespace simdpp |
35 | |
36 | #endif |
37 | |