1#ifndef VECCORE_BACKEND_SCALAR_WRAPPER_H
2#define VECCORE_BACKEND_SCALAR_WRAPPER_H
18 static constexpr size_t Size = 1;
26 static constexpr size_t Size = 1;
31template <
typename T = Real_s>
55 static constexpr size_t Size = 1;
64 bool isFull()
const {
return fBool; }
70 static constexpr size_t size() {
return 1; }
73 operator bool &()
noexcept {
return fBool; }
76 operator bool const &()
const noexcept {
return fBool; }
95 void store(
bool *dest)
const { *dest = fBool; }
112#define MASK_ASSIGN_OPERATOR(OP) \
113 VECCORE_ATT_HOST_DEVICE \
114 T &operator OP(const T &ref) \
116 if (fMask) fRef OP ref; \
132#undef MASK_ASSIGN_OPERATOR
145 static constexpr size_t Size = 1;
160 template <typename Type, class = typename std::enable_if<std::is_integral<Type>::value>::type>
167 static constexpr size_t size() {
return 1; }
170 operator T &()
noexcept {
return fVal; }
173 operator T
const &()
const noexcept {
return fVal; }
195 void load(T
const *
const src) { fVal = *src; }
198 void store(T &dest)
const { dest = fVal; }
201 void store(T *dest)
const { *dest = fVal; }
203#define SCALAR_WRAPPER_OPERATOR(OP) \
204 VECCORE_FORCE_INLINE \
205 VECCORE_ATT_HOST_DEVICE \
206 WrappedScalar operator OP(const WrappedScalar &x) const { return WrappedScalar(fVal OP x.fVal); } \
208 VECCORE_FORCE_INLINE \
209 VECCORE_ATT_HOST_DEVICE \
210 WrappedScalar operator OP(const T &x) const { return WrappedScalar(fVal OP x); }
218#undef SCALAR_WRAPPER_OPERATOR
254 dst = mask ? src1 : src2;
#define VECCORE_ATT_HOST_DEVICE
#define VECCORE_FORCE_INLINE
#define MASK_ASSIGN_OPERATOR(OP)
#define SCALAR_WRAPPER_OPERATOR(OP)
VECCORE_ATT_HOST_DEVICE MaskedScalar()=delete
VECCORE_ATT_HOST_DEVICE MaskedScalar(T &ref, Mask mask=true)
VECCORE_ATT_HOST_DEVICE bool isFull() const
static VECCORE_ATT_HOST_DEVICE constexpr size_t size()
VECCORE_ATT_HOST_DEVICE WrappedBool()
VECCORE_ATT_HOST_DEVICE bool isEmpty() const
VECCORE_ATT_HOST_DEVICE WrappedBool(bool val)
VECCORE_ATT_HOST_DEVICE bool operator[](int index) const
VECCORE_ATT_HOST_DEVICE void store(bool *dest) const
VECCORE_ATT_HOST_DEVICE bool & operator[](int index)
static constexpr size_t Size
VECCORE_ATT_HOST_DEVICE WrappedScalar(const Type &val)
static VECCORE_ATT_HOST_DEVICE constexpr size_t size()
VECCORE_ATT_HOST_DEVICE WrappedScalar(const T &val)
VECCORE_ATT_HOST_DEVICE T & operator[](int index)
VECCORE_ATT_HOST_DEVICE WrappedScalar()
VECCORE_ATT_HOST_DEVICE void load(T const *const src)
VECCORE_ATT_HOST_DEVICE void store(T *dest) const
static constexpr size_t Size
VECCORE_ATT_HOST_DEVICE MaskedScalar< T > operator()(Mask m)
VECCORE_ATT_HOST_DEVICE WrappedScalar(const T *const val_ptr)
VECCORE_ATT_HOST_DEVICE T const operator[](int index) const
VECCORE_ATT_HOST_DEVICE void store(T &dest) const
VECCORE_ATT_HOST_DEVICE WrappedScalar(const WrappedScalar *const s)
VECCORE_FORCE_INLINE VECCORE_ATT_HOST_DEVICE bool MaskEmpty< WrappedBool >(const WrappedBool &mask)
VECCORE_FORCE_INLINE VECCORE_ATT_HOST_DEVICE bool MaskFull< WrappedBool >(const WrappedBool &mask)
VECCORE_FORCE_INLINE static VECCORE_ATT_HOST_DEVICE void Assign(WrappedScalar< T > &dst, WrappedBool const &mask, WrappedScalar< T > const &src)
VECCORE_FORCE_INLINE static VECCORE_ATT_HOST_DEVICE void Blend(WrappedScalar< T > &dst, WrappedBool const &mask, WrappedScalar< T > const &src1, WrappedScalar< T > const &src2)
static constexpr size_t Size