mirror of https://github.com/AxioDL/zeus.git
Additional CVector2f operators
This commit is contained in:
parent
26ea606a09
commit
5282ae6308
|
@ -212,7 +212,7 @@ public:
|
||||||
inline CVector2f operator/(float val) const
|
inline CVector2f operator/(float val) const
|
||||||
{
|
{
|
||||||
#if __SSE__
|
#if __SSE__
|
||||||
TVectorUnion splat = {{val, val, val, 0.0f}};
|
TVectorUnion splat = {{val, val, 0.0f, 0.0f}};
|
||||||
return CVector2f(_mm_div_ps(mVec128, splat.mVec128));
|
return CVector2f(_mm_div_ps(mVec128, splat.mVec128));
|
||||||
#else
|
#else
|
||||||
return CVector2f(x / val, y / val);
|
return CVector2f(x / val, y / val);
|
||||||
|
@ -255,6 +255,50 @@ public:
|
||||||
#else
|
#else
|
||||||
x /= rhs.x;
|
x /= rhs.x;
|
||||||
y /= rhs.y;
|
y /= rhs.y;
|
||||||
|
#endif
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
inline const CVector2f& operator+=(float rhs)
|
||||||
|
{
|
||||||
|
#if __SSE__
|
||||||
|
TVectorUnion splat = {{rhs, rhs, 0.f, 0.0f}};
|
||||||
|
mVec128 = _mm_add_ps(mVec128, splat.mVec128);
|
||||||
|
#else
|
||||||
|
x += rhs;
|
||||||
|
y += rhs;
|
||||||
|
#endif
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
inline const CVector2f& operator-=(float rhs)
|
||||||
|
{
|
||||||
|
#if __SSE__
|
||||||
|
TVectorUnion splat = {{rhs, rhs, 0.f, 0.0f}};
|
||||||
|
mVec128 = _mm_sub_ps(mVec128, splat.mVec128);
|
||||||
|
#else
|
||||||
|
x -= rhs;
|
||||||
|
y -= rhs;
|
||||||
|
#endif
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
inline const CVector2f& operator*=(float rhs)
|
||||||
|
{
|
||||||
|
#if __SSE__
|
||||||
|
TVectorUnion splat = {{rhs, rhs, 0.f, 0.0f}};
|
||||||
|
mVec128 = _mm_mul_ps(mVec128, splat.mVec128);
|
||||||
|
#else
|
||||||
|
x *= rhs;
|
||||||
|
y *= rhs;
|
||||||
|
#endif
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
inline const CVector2f& operator/=(float rhs)
|
||||||
|
{
|
||||||
|
#if __SSE__
|
||||||
|
TVectorUnion splat = {{rhs, rhs, 0.f, 0.0f}};
|
||||||
|
mVec128 = _mm_div_ps(mVec128, splat.mVec128);
|
||||||
|
#else
|
||||||
|
x /= rhs;
|
||||||
|
y /= rhs;
|
||||||
#endif
|
#endif
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue