Skip to content

Commit

Permalink
Convert last vbool m_val[] to other idioms. Now there are no refs to …
Browse files Browse the repository at this point in the history
…m_val or m_vals at all, except for the declarations in the unions themselves.

WORKS

Signed-off-by: Larry Gritz <lg@larrygritz.com>
  • Loading branch information
lgritz committed Mar 10, 2024
1 parent 1abfa24 commit 1e09ef1
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions src/include/OpenImageIO/simd.h
Original file line number Diff line number Diff line change
Expand Up @@ -3653,7 +3653,7 @@ OIIO_FORCEINLINE int vbool8::operator[] (int i) const {
#if OIIO_SIMD_AVX
return ((_mm256_movemask_ps(m_simd) >> i) & 1) ? -1 : 0;
#else
return m_val[i];
return ((const int *)this)[i];
#endif
}

Expand All @@ -3664,7 +3664,7 @@ OIIO_FORCEINLINE void vbool8::setcomp (int i, bool value) {

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


Expand Down Expand Up @@ -3699,14 +3699,14 @@ OIIO_FORCEINLINE void vbool8::load(bool a, bool b, bool c, bool d,
m_4[0].load(a, b, c, d);
m_4[1].load(e, f, g, h);
#else
m_val[0] = -int(a);
m_val[1] = -int(b);
m_val[2] = -int(c);
m_val[3] = -int(d);
m_val[4] = -int(e);
m_val[5] = -int(f);
m_val[6] = -int(g);
m_val[7] = -int(h);
((int *)this)[0] = -int(a);
((int *)this)[1] = -int(b);
((int *)this)[2] = -int(c);
((int *)this)[3] = -int(d);
((int *)this)[4] = -int(e);
((int *)this)[5] = -int(f);
((int *)this)[6] = -int(g);
((int *)this)[7] = -int(h);
#endif
}

Expand Down Expand Up @@ -3785,13 +3785,13 @@ OIIO_FORCEINLINE const vbool8 vbool8::True () {


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

OIIO_FORCEINLINE void vbool8::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 1e09ef1

Please sign in to comment.