Skip to content

Commit

Permalink
Replace some m_val uses in vbool4
Browse files Browse the repository at this point in the history
Signed-off-by: Larry Gritz <lg@larrygritz.com>
  • Loading branch information
lgritz committed Mar 9, 2024
1 parent eef1247 commit 7addee2
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/include/OpenImageIO/simd.h
Original file line number Diff line number Diff line change
Expand Up @@ -2543,7 +2543,7 @@ class matrix44 {
/// Stream output
friend inline std::ostream& operator<< (std::ostream& cout, const matrix44 &M);

const float* data() const { return m_vals[0]; }
const value_t* data () const { return (const value_t*)this; }

private:
union {
Expand Down Expand Up @@ -3301,13 +3301,13 @@ OIIO_FORCEINLINE int vbool4::operator[] (int i) const {
#if OIIO_SIMD_SSE
return ((_mm_movemask_ps(m_simd) >> i) & 1) ? -1 : 0;
#else
return m_val[i];
return ((const int *)this)[i];
#endif
}

OIIO_FORCEINLINE int& vbool4::operator[] (int i) {
OIIO_DASSERT(i >= 0 && i < elements);
return m_val[i];
return ((int *)this)[i];
}


Expand Down Expand Up @@ -3347,10 +3347,10 @@ OIIO_FORCEINLINE void vbool4::load (bool a, bool b, bool c, bool d) {
// this if we were using int:
// m_simd = vld1q_s32(values);
#else
m_val[0] = -int(a);
m_val[1] = -int(b);
m_val[2] = -int(c);
m_val[3] = -int(d);
setcomp(0, a);
setcomp(1, b);
setcomp(2, c);
setcomp(3, d);
#endif
}

Expand All @@ -3375,7 +3375,7 @@ OIIO_FORCEINLINE int vbool4::bitmask () const {
#else
int r = 0;
for (int i = 0; i < elements; ++i)
if (m_val[i])
if ((*this)[i])
r |= 1<<i;
return r;
#endif
Expand Down Expand Up @@ -3421,13 +3421,13 @@ OIIO_FORCEINLINE const vbool4 vbool4::True () {
}

OIIO_FORCEINLINE void vbool4::store (bool *values) const {
SIMD_DO (values[i] = m_val[i] ? true : false);
SIMD_DO (values[i] = (*this)[i] ? true : false);
}

OIIO_FORCEINLINE void vbool4::store (bool *values, int n) const {
OIIO_DASSERT (n >= 0 && n <= elements);
for (int i = 0; i < n; ++i)
values[i] = m_val[i] ? true : false;
values[i] = (*this)[i] ? true : false;
}


Expand Down

0 comments on commit 7addee2

Please sign in to comment.