test_bits.h 982 B

123456789101112131415161718192021222324252627282930313233343536
  1. /* Copyright (C) 2016 Povilas Kanapickas <[email protected]>
  2. Distributed under the Boost Software License, Version 1.0.
  3. (See accompanying file LICENSE_1_0.txt or copy at
  4. http://www.boost.org/LICENSE_1_0.txt)
  5. */
  6. #ifndef LIBSIMDPP_SIMD_CORE_TEST_BITS_H
  7. #define LIBSIMDPP_SIMD_CORE_TEST_BITS_H
  8. #ifndef LIBSIMDPP_SIMD_H
  9. #error "This file must be included through simd.h"
  10. #endif
  11. #include <simdpp/types.h>
  12. #include <simdpp/detail/expr/test_bits.h>
  13. #include <simdpp/detail/get_expr.h>
  14. namespace simdpp {
  15. namespace SIMDPP_ARCH_NAMESPACE {
  16. /** Returns true if any bits are set in the given vector.
  17. */
  18. template<unsigned N, class V> SIMDPP_INL
  19. bool test_bits_any(const any_vec<N,V>& a)
  20. {
  21. static_assert(!is_mask<V>::value, "Mask types are not supported");
  22. using expr = typename detail::get_expr_nosign<V, typename V::expr_type>::type;
  23. return detail::e_test_bits_any(expr(a));
  24. }
  25. } // namespace SIMDPP_ARCH_NAMESPACE
  26. } // namespace simdpp
  27. #endif