29 #ifndef VC_COMMON_ALGORITHMS_H_
30 #define VC_COMMON_ALGORITHMS_H_
34 namespace Vc_VERSIONED_NAMESPACE
50 constexpr
bool all_of(
bool b) {
return b; }
59 constexpr
bool any_of(
bool b) {
return b; }
68 constexpr
bool none_of(
bool b) {
return !b; }
78 constexpr
bool some_of(
bool) {
return false; }
81 template <
typename InputIt,
typename UnaryFunction>
82 inline enable_if<std::is_arithmetic<typename InputIt::value_type>::value &&
83 Traits::is_functor_argument_immutable<
84 UnaryFunction, Vector<typename InputIt::value_type>>::value,
86 simd_for_each(InputIt first, InputIt last, UnaryFunction f)
88 typedef Vector<typename InputIt::value_type> V;
89 typedef Scalar::Vector<typename InputIt::value_type> V1;
90 for (;
reinterpret_cast<std::uintptr_t
>(std::addressof(*first)) &
96 const auto lastV = last - (V::Size + 1);
97 for (; first < lastV; first += V::Size) {
100 for (; first != last; ++first) {
106 template <
typename InputIt,
typename UnaryFunction>
107 inline enable_if<std::is_arithmetic<typename InputIt::value_type>::value &&
108 !Traits::is_functor_argument_immutable<
109 UnaryFunction, Vector<typename InputIt::value_type>>::value,
111 simd_for_each(InputIt first, InputIt last, UnaryFunction f)
113 typedef Vector<typename InputIt::value_type> V;
114 typedef Scalar::Vector<typename InputIt::value_type> V1;
115 for (;
reinterpret_cast<std::uintptr_t
>(std::addressof(*first)) &
123 const auto lastV = last - (V::Size + 1);
124 for (; first < lastV; first += V::Size) {
129 for (; first != last; ++first) {
137 template <
typename InputIt,
typename UnaryFunction>
138 inline enable_if<!std::is_arithmetic<typename InputIt::value_type>::value, UnaryFunction>
139 simd_for_each(InputIt first, InputIt last, UnaryFunction f)
141 return std::for_each(first, last, std::move(f));
146 #endif // VC_COMMON_ALGORITHMS_H_
constexpr bool any_of(bool b)
Returns b.
bool isFull() const
Returns a logical AND of all components.
constexpr bool none_of(bool b)
Returns !b.
constexpr bool all_of(bool b)
Returns b.
constexpr AlignedTag Aligned
Use this object for a flags parameter to request aligned loads and stores.
constexpr bool some_of(bool)
Returns false.
The main SIMD mask class.
bool isNotEmpty() const
Returns a logical OR of all components.
constexpr std::size_t MemoryAlignment
Specifies the most conservative memory alignment necessary for aligned loads and stores of Vector typ...
bool isEmpty() const
Returns true if components are false, false otherwise.
bool isMix() const
Returns !isFull() && !isEmpty().