28 #ifndef VC_COMMON_MASK_H_
29 #define VC_COMMON_MASK_H_
33 namespace Vc_VERSIONED_NAMESPACE
41 template <
typename T,
typename Abi = VectorAbi::Best<T>>
class Mask
57 static constexpr
size_t size() {
return VectorTraits<T, Abi>::size(); }
60 static constexpr
size_t Size = VectorTraits<T, Abi>::size();
66 static constexpr
size_t MemoryAlignment = VectorTraits<T, Abi>::maskMemoryAlignment();
93 using VectorType =
typename VectorTraits<T, Abi>::VectorType;
97 using vector_type = VectorType;
118 Vc_INTRINSIC
static Mask One();
121 template <
typename G>
static Vc_INTRINSIC
Mask generate(G &&gen);
135 Vc_INTRINSIC
Mask() =
default;
139 Vc_INTRINSIC
explicit Mask(VectorSpecialInitializerZero);
143 Vc_INTRINSIC
explicit Mask(VectorSpecialInitializerOne);
155 Vc_INTRINSIC
explicit Mask(
bool b);
163 template <
typename U>
164 Vc_INTRINSIC
Mask(U &&otherMask,
165 Common::enable_if_mask_converts_implicitly<T, U> = nullarg);
176 template <
typename U>
178 "use simd_cast instead of explicit type casting to convert between mask types")
180 explicit
Mask(U &&otherMask, Common::enable_if_mask_converts_explicitly<T, U> =
181 nullarg) Vc_INTRINSIC_R;
198 Vc_ALWAYS_INLINE
explicit Mask(
const bool *mem);
207 template <
typename Flags> Vc_ALWAYS_INLINE
explicit Mask(
const bool *mem, Flags flags);
215 Vc_ALWAYS_INLINE
void load(
const bool *mem);
224 template <
typename Flags> Vc_ALWAYS_INLINE
void load(
const bool *mem, Flags flags);
232 Vc_ALWAYS_INLINE
void store(
bool *mem)
const;
240 template <
typename Flags> Vc_ALWAYS_INLINE
void store(
bool *mem, Flags flags)
const;
283 Vc_ALWAYS_INLINE
Mask operator&&(
const Mask &mask)
const;
287 Vc_ALWAYS_INLINE
Mask operator||(
const Mask &mask)
const;
293 Vc_ALWAYS_INLINE
Mask operator!()
const;
296 Vc_ALWAYS_INLINE
Mask &operator&=(
const Mask &mask);
298 Vc_ALWAYS_INLINE
Mask &operator|=(
const Mask &mask);
300 Vc_ALWAYS_INLINE
Mask &operator^=(
const Mask &mask);
311 Vc_ALWAYS_INLINE
bool isFull()
const;
313 Vc_ALWAYS_INLINE
bool isNotEmpty()
const;
315 Vc_ALWAYS_INLINE
bool isEmpty()
const;
317 Vc_ALWAYS_INLINE
bool isMix()
const;
323 Vc_ALWAYS_INLINE
bool data()
const;
325 Vc_ALWAYS_INLINE
bool dataI()
const;
326 Vc_ALWAYS_INLINE
bool dataD()
const;
352 Vc_ALWAYS_INLINE
EntryType operator[](
size_t index)
const;
356 Vc_ALWAYS_INLINE
int count()
const;
368 Vc_ALWAYS_INLINE
int firstOne()
const;
377 Vc_ALWAYS_INLINE
int toInt()
const;
380 Vc_INTRINSIC Vc_PURE
Mask shifted(
int amount)
const;
382 Vc_FREE_STORE_OPERATORS_ALIGNED(
alignof(
Mask));
390 #endif // VC_COMMON_MASK_H_
typename VectorTraits< T, Abi >::EntryReference EntryReference
The reference wrapper type used for accessing individual mask components.
bool EntryType
The EntryType of masks is always bool, independent of T.
result_vector_type< L, R > operator|(L &&lhs, R &&rhs)
Applies | component-wise and concurrently.
result_vector_type< L, R > operator^(L &&lhs, R &&rhs)
Applies ^ component-wise and concurrently.
static constexpr size_t size()
Returns the number of boolean components ( ) in a mask of this type.
result_vector_type< L, R >::mask_type operator!=(L &&lhs, R &&rhs)
Applies != component-wise and concurrently.
Abi abi
The ABI tag type of the current template instantiation.
EntryType value_type
The EntryType of masks is always bool, independent of T.
result_vector_type< L, R >::mask_type operator==(L &&lhs, R &&rhs)
Applies == component-wise and concurrently.
typename VectorTraits< T, Abi >::VectorEntryType VectorEntryType
The VectorEntryType, in contrast to EntryType, reveals information about the SIMD implementation...
EntryReference value_reference
The reference wrapper type used for accessing individual mask components.
result_vector_type< L, R > operator&(L &&lhs, R &&rhs)
Applies & component-wise and concurrently.
The main SIMD mask class.
constexpr VectorSpecialInitializerZero Zero
The special object Vc::Zero can be used to construct Vector and Mask objects initialized to zero/fals...
Adapter< S, T, N > shifted(const Adapter< S, T, N > &a, int shift)
Returns a new vectorized object where each entry is shifted by shift.
constexpr VectorSpecialInitializerOne One
The special object Vc::One can be used to construct Vector and Mask objects initialized to one/true...
constexpr std::size_t MemoryAlignment
Specifies the most conservative memory alignment necessary for aligned loads and stores of Vector typ...