29 #ifndef VC_COMMON_MASKENTRY_H_ 
   30 #define VC_COMMON_MASKENTRY_H_ 
   34 namespace Vc_VERSIONED_NAMESPACE
 
   39 template<
typename M> 
class MaskEntry
 
   45     constexpr MaskEntry(M &m, 
size_t o) : mask(m), offset(o) {}
 
   50     constexpr MaskEntry(MaskEntry &&) = 
default;
 
   51     MaskEntry(
const MaskEntry &) = 
delete;
 
   52     MaskEntry &operator=(
const MaskEntry &) = 
delete;
 
   53     MaskEntry &operator=(MaskEntry &&) = 
delete;
 
   55     template <typename B, typename = enable_if<std::is_same<B, bool>::value>>
 
   56     Vc_INTRINSIC Vc_PURE 
operator B()
 const 
   61     Vc_INTRINSIC MaskEntry &operator=(
bool x)
 
   63         mask.setEntry(offset, x);
 
   70     template<
size_t Bytes> 
struct MaskBoolStorage;
 
   73     template<> 
struct MaskBoolStorage<1> { 
typedef std::int8_t  type; };
 
   74     template<> 
struct MaskBoolStorage<2> { 
typedef std::int16_t type; };
 
   75     template<> 
struct MaskBoolStorage<4> { 
typedef std::int32_t type; };
 
   76     template<> 
struct MaskBoolStorage<8> { 
typedef std::int64_t type; };
 
   79 template<
size_t Bytes> 
class MaskBool
 
   81     typedef typename MaskBoolStorage<Bytes>::type storage_type Vc_MAY_ALIAS;
 
   84     constexpr MaskBool(
bool x) : data(x ? -1 : 0) {}
 
   85     Vc_ALWAYS_INLINE MaskBool &operator=(
bool x) { data = x ? -1 : 0; 
return *
this; }
 
   86     template <typename T, typename = enable_if<(!std::is_same<T, bool>::value &&
 
   87                                                 std::is_fundamental<T>::value)>>
 
   88     Vc_ALWAYS_INLINE MaskBool &
operator=(T x)
 
   90         data = 
reinterpret_cast<const storage_type &
>(x);
 
   94     Vc_ALWAYS_INLINE MaskBool(
const MaskBool &) = 
default;
 
   95     Vc_ALWAYS_INLINE MaskBool &operator=(
const MaskBool &) = 
default;
 
   97     template <typename T, typename = enable_if<(std::is_same<T, bool>::value ||
 
   98                                                 (std::is_fundamental<T>::value &&
 
   99                                                  sizeof(storage_type) == 
sizeof(T)))>>
 
  100     constexpr 
operator T()
 const 
  102         return std::is_same<T, bool>::value ? T((data & 1) != 0)
 
  103                                             : reinterpret_cast<const MayAlias<T> &>(data);
 
  107 template <
typename A,
 
  109           typename std::enable_if<
 
  110               std::is_convertible<A, bool>::value &&std::is_convertible<B, bool>::value,
 
  114     return static_cast<bool>(a) == static_cast<bool>(b);
 
  116 template <
typename A,
 
  118           typename std::enable_if<
 
  119               std::is_convertible<A, bool>::value &&std::is_convertible<B, bool>::value,
 
  123     return static_cast<bool>(a) != static_cast<bool>(b);
 
  126 static_assert(
true == MaskBool<4>(
true), 
"true == MaskBool<4>(true)");
 
  127 static_assert(
true != MaskBool<4>(
false), 
"true != MaskBool<4>(false)");
 
  132 #endif // VC_COMMON_MASKENTRY_H_ 
result_vector_type< L, R >::mask_type operator!=(L &&lhs, R &&rhs)
Applies != component-wise and concurrently. 
result_vector_type< L, R >::mask_type operator==(L &&lhs, R &&rhs)
Applies == component-wise and concurrently.