13 #define SPH_NO_ROUNDING_MODE
33 data.i = _mm_set1_epi32(value);
38 data.i = _mm_set_epi32(l, k, j,
i);
42 #ifndef SPH_NO_ROUNDING_MODE
44 data = _mm_cvtps_epi32(v.
sse());
48 :
Indices(int(v[
X]), int(v[
Y]), int(v[
Z]), int(v[
H])) {}
53 *
this =
Indices(
int(v[0]),
int(v[1]),
int(v[2]),
int(v[3]));
61 #ifndef SPH_NO_ROUNDING_MODE
62 _MM_SET_ROUNDING_MODE(_MM_ROUND_DOWN);
71 #ifndef SPH_NO_ROUNDING_MODE
97 return _mm_cmpeq_epi32(data.i, other.data.
i);
101 return _mm_xor_si128(_mm_cmpeq_epi32(data.i, other.data.
i), _mm_set1_epi32(-1));
105 return _mm_cmpgt_epi32(data.i, other.data.
i);
109 return _mm_cmplt_epi32(data.i, other.data.
i);
113 return _mm_add_epi32(data.i, other.data.
i);
117 return _mm_sub_epi32(data.i, other.data.
i);
121 return _mm_max_epi32(data.i, other.data.
i);
125 return _mm_min_epi32(data.i, other.data.
i);
129 for (
int i = 0;
i < 3; ++
i) {
130 stream << std::setw(20) << idxs[
i];
145 return i[0] && i[1] && i[2];
149 return i[0] || i[1] || i[2];
159 return all(i1 == i2);
169 return (idxs[0] * 73856093ull) ^ (idxs[1] * 19349663ull) ^ (idxs[2] * 83492791ull);
#define SPH_ASSERT(x,...)
INLINE auto floor(const Vector &v)
INLINE bool any(const Indices &i)
INLINE bool all(const Indices &i)
INLINE Indices max(const Indices i1, const Indices i2)
INLINE Indices min(const Indices i1, const Indices i2)
Common macros and basic objects.
#define INLINE
Macros for conditional compilation based on selected compiler.
#define NAMESPACE_SPH_END
Basic vector algebra. Computations are accelerated using SIMD.
specialization for doubles or units of double precision
3-dimensional vector, float precision
INLINE const __m128 & sse() const
Returns the data as SSE vector.
Helper object for storing three (possibly four) int or bool values.
INLINE Indices & operator=(const Indices &other)
INLINE Indices(__m128i i)
INLINE Indices max(const Indices &other) const
friend std::ostream & operator<<(std::ostream &stream, const Indices &idxs)
INLINE int & operator[](const int idx)
INLINE Indices operator>(const Indices &other) const
INLINE Indices(const BasicVector< double > &v)
INLINE Indices(const Indices &other)
INLINE Indices operator<(const Indices &other) const
INLINE Indices operator!=(const Indices &other)
INLINE Indices operator==(const Indices &other) const
INLINE Indices(const int value)
Constructs indices from single value by copying it to all components.
INLINE Indices operator+(const Indices &other) const
static INLINE void init()
Must be called once before Indices are used.
INLINE Indices operator-(const Indices &other) const
INLINE Indices(const BasicVector< float > &v)
Constructs indices by casting components of vectors to ints.
INLINE Indices min(const Indices &other) const
INLINE int operator[](const int idx) const
INLINE Indices(const int i, const int j, const int k, const int l=0)
Constructs indices from values. Fourth component is optional.
INLINE size_t operator()(const Sph::Indices &idxs) const
INLINE bool operator()(const Indices &i1, const Indices &i2) const