bit_not.h 1.6 KB

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