📄 ivec.h
字号:
Iu32vec2& operator +=(const I32vec2 &a) { return *this = (Iu32vec2) _m_paddd(vec,a); }
Iu32vec2& operator -=(const I32vec2 &a) { return *this = (Iu32vec2) _m_psubd(vec,a); }
/* Shift Logical Operators */
Iu32vec2 operator<<(const M64 &a) { return _m_pslld(vec,a); }
Iu32vec2 operator<<(int count) { return _m_pslldi(vec,count); }
Iu32vec2& operator<<=(const M64 &a) { return *this = (Iu32vec2) _m_pslld(vec,a); }
Iu32vec2& operator<<=(int count) { return *this = (Iu32vec2) _m_pslldi(vec,count); }
Iu32vec2 operator>>(const M64 &a) { return _m_psrld(vec,a); }
Iu32vec2 operator>>(int count) { return _m_psrldi(vec,count); }
Iu32vec2& operator>>=(const M64 &a) { return *this = (Iu32vec2) _m_psrld(vec,a); }
Iu32vec2& operator>>=(int count) { return *this = (Iu32vec2) _m_psrldi(vec,count); }
#if defined (_ENABLE_VEC_DEBUG)
/* Output for Debug */
friend std::ostream& operator<< (std::ostream &os, const Iu32vec2 &a)
{
os << " [1]:" << _MM_2UDW(1,a)
<< " [0]:" << _MM_2UDW(0,a);
return os;
}
#endif /* defined (_ENABLE_VEC_DEBUG) */
/* Element Access for Debug, No data modified */
const unsigned int& operator[](int i)const
{
_VEC_ASSERT(static_cast<unsigned int>(i) < 2); /* Only 2 elements to access */
return _MM_2UDW(i,vec);
}
/* Element Access and Assignment for Debug */
unsigned int& operator[](int i)
{
_VEC_ASSERT(static_cast<unsigned int>(i) < 2); /* Only 2 elements to access */
return _MM_2UDW(i,vec);
}
};
/* Compares For Equality / Inequality */
inline Iu32vec2 cmpeq(const Iu32vec2 &a, const Iu32vec2 &b) { return _m_pcmpeqd(a,b); }
inline Iu32vec2 cmpneq(const Iu32vec2 &a, const Iu32vec2 &b) { return _m_pandn(_m_pcmpeqd(a,b), M64(0xffffffffffffffffi64)); }
/* Unpacks */
inline Iu32vec2 unpack_low(const Iu32vec2 &a, const Iu32vec2 &b) {return _m_punpckldq(a,b); }
inline Iu32vec2 unpack_high(const Iu32vec2 &a, const Iu32vec2 &b) {return _m_punpckhdq(a,b); }
/* I16vec4 Class:
* 4 elements, each element either a signed or unsigned short
*/
class I16vec4 : public M64
{
public:
I16vec4() { }
I16vec4(__m64 mm) : M64(mm) { }
explicit I16vec4(__int64 i) : M64 (i) { }
explicit I16vec4(int i) : M64 (i) { }
/* Assignment Operator */
I16vec4& operator= (const M64 &a) { return *this = (I16vec4) a; }
/* Addition & Subtraction Assignment Operators */
I16vec4& operator&=(const M64 &a) { return *this = (I16vec4) _m_pand(vec,a); }
I16vec4& operator|=(const M64 &a) { return *this = (I16vec4) _m_por(vec,a); }
I16vec4& operator^=(const M64 &a) { return *this = (I16vec4) _m_pxor(vec,a); }
/* Addition & Subtraction Assignment Operators */
I16vec4& operator +=(const I16vec4 &a) { return *this = (I16vec4)_m_paddw(vec,a); }
I16vec4& operator -=(const I16vec4 &a) { return *this = (I16vec4)_m_psubw(vec,a); }
I16vec4& operator *=(const I16vec4 &a) { return *this = (I16vec4)_m_pmullw(vec,a); }
/* Shift Logical Operators */
I16vec4 operator<<(const I16vec4 &a) { return _m_psllw(vec,a); }
I16vec4 operator<<(int count) { return _m_psllwi(vec,count); }
I16vec4& operator<<=(const I16vec4 &a) { return *this = (I16vec4)_m_psllw(vec,a); }
I16vec4& operator<<=(int count) { return *this = (I16vec4)_m_psllwi(vec,count); }
};
inline I16vec4 operator*(const I16vec4 &a, const I16vec4 &b) { return _m_pmullw(a,b); }
inline I16vec4 cmpeq(const I16vec4 &a, const I16vec4 &b) { return _m_pcmpeqw(a,b); }
inline I16vec4 cmpneq(const I16vec4 &a, const I16vec4 &b) { return _m_pandn(_m_pcmpeqw(a,b), M64(0xffffffffffffffffi64)); }
inline I16vec4 unpack_low(const I16vec4 &a, const I16vec4 &b) { return _m_punpcklwd(a,b); }
inline I16vec4 unpack_high(const I16vec4 &a, const I16vec4 &b) { return _m_punpckhwd(a,b); }
/* Is16vec4 Class:
* 4 elements, each element signed short
*/
class Is16vec4 : public I16vec4
{
public:
Is16vec4() { }
Is16vec4(__m64 mm) : I16vec4(mm) { }
Is16vec4(short i0, short i1, short i2, short i3)
{
_MM_4W(0,vec) = i3;
_MM_4W(1,vec) = i2;
_MM_4W(2,vec) = i1;
_MM_4W(3,vec) = i0;
}
explicit Is16vec4(__int64 i) : I16vec4 (i) { }
explicit Is16vec4(int i) : I16vec4 (i) { }
/* Assignment Operator */
Is16vec4& operator= (const M64 &a) { return *this = (Is16vec4) a; }
/* Addition & Subtraction Assignment Operators */
Is16vec4& operator&=(const M64 &a) { return *this = (Is16vec4) _m_pand(vec,a); }
Is16vec4& operator|=(const M64 &a) { return *this = (Is16vec4) _m_por(vec,a); }
Is16vec4& operator^=(const M64 &a) { return *this = (Is16vec4) _m_pxor(vec,a); }
/* Addition & Subtraction Assignment Operators */
Is16vec4& operator +=(const I16vec4 &a) { return *this = (Is16vec4)_m_paddw(vec,a); }
Is16vec4& operator -=(const I16vec4 &a) { return *this = (Is16vec4)_m_psubw(vec,a); }
Is16vec4& operator *=(const I16vec4 &a) { return *this = (Is16vec4)_m_pmullw(vec,a); }
/* Shift Logical Operators */
Is16vec4 operator<<(const M64 &a) { return _m_psllw(vec,a); }
Is16vec4 operator<<(int count) { return _m_psllwi(vec,count); }
Is16vec4& operator<<=(const M64 &a) { return *this = (Is16vec4)_m_psllw(vec,a); }
Is16vec4& operator<<=(int count) { return *this = (Is16vec4)_m_psllwi(vec,count); }
/* Shift Arithmetic Operations */
Is16vec4 operator>>(const M64 &a) { return _m_psraw(vec,a); }
Is16vec4 operator>>(int count) { return _m_psrawi(vec,count); }
Is16vec4& operator>>=(const M64 &a) { return *this = (Is16vec4) _m_psraw(vec,a); }
Is16vec4& operator>>=(int count) { return *this = (Is16vec4) _m_psrawi(vec,count); }
#if defined (_ENABLE_VEC_DEBUG)
/* Output for Debug */
friend std::ostream& operator<< (std::ostream &os, const Is16vec4 &a)
{
os << "[3]:" << _MM_4W(3,a)
<< " [2]:" << _MM_4W(2,a)
<< " [1]:" << _MM_4W(1,a)
<< " [0]:" << _MM_4W(0,a);
return os;
}
#endif /* defined (_ENABLE_VEC_DEBUG) */
/* Element Access for Debug, No data modified */
const short& operator[](int i)const
{
_VEC_ASSERT(static_cast<unsigned int>(i) < 4); /* Only 4 elements to access */
return _MM_4W(i,vec);
}
/* Element Access for Debug */
short& operator[](int i)
{
_VEC_ASSERT(static_cast<unsigned int>(i) < 4); /* Only 4 elements to access */
return _MM_4W(i,vec);
}
};
inline Is16vec4 operator*(const Is16vec4 &a, const Is16vec4 &b) { return _m_pmullw(a,b); }
/* Compares */
inline Is16vec4 cmpeq(const Is16vec4 &a, const Is16vec4 &b) { return _m_pcmpeqw(a,b); }
inline Is16vec4 cmpneq(const Is16vec4 &a, const Is16vec4 &b) { return _m_pandn(_m_pcmpeqw(a,b), M64(0xffffffffffffffffi64)); }
inline Is16vec4 cmpgt(const Is16vec4 &a, const Is16vec4 &b) { return _m_pcmpgtw(a,b); }
inline Is16vec4 cmplt(const Is16vec4 &a, const Is16vec4 &b) { return _m_pcmpgtw(b,a); }
inline Is16vec4 cmple(const Is16vec4 &a, const Is16vec4 &b) { return _m_pandn(_m_pcmpgtw(a,b), M64(0xffffffffffffffffi64)); }
inline Is16vec4 cmpge(const Is16vec4 &a, const Is16vec4 &b) { return _m_pandn(_m_pcmpgtw(b,a), M64(0xffffffffffffffffi64)); }
/* Unpacks */
inline Is16vec4 unpack_low(const Is16vec4 &a, const Is16vec4 &b) { return _m_punpcklwd(a,b); }
inline Is16vec4 unpack_high(const Is16vec4 &a, const Is16vec4 &b) { return _m_punpckhwd(a,b); }
inline Is16vec4 sat_add(const Is16vec4 &a, const Is16vec4 &b) { return _m_paddsw(a,b); }
inline Is16vec4 sat_sub(const Is16vec4 &a, const Is16vec4 &b) { return _m_psubsw(a,b); }
inline Is16vec4 mul_high(const Is16vec4 &a, const Is16vec4 &b) { return _m_pmulhw(a,b); }
inline Is32vec2 mul_add(const Is16vec4 &a, const Is16vec4 &b) { return _m_pmaddwd(a,b);}
/* Iu16vec4 Class:
* 4 elements, each element unsigned short
*/
class Iu16vec4 : public I16vec4
{
public:
Iu16vec4() { }
Iu16vec4(__m64 mm) : I16vec4(mm) { }
Iu16vec4(unsigned short ui0, unsigned short ui1, unsigned short ui2, unsigned short ui3)
{
_MM_4UW(0,vec) = ui3;
_MM_4UW(1,vec) = ui2;
_MM_4UW(2,vec) = ui1;
_MM_4UW(3,vec) = ui0;
}
explicit Iu16vec4(__int64 i) : I16vec4 (i) { }
explicit Iu16vec4(int i) : I16vec4 (i) { }
/* Assignment Operator */
Iu16vec4& operator= (const M64 &a) { return *this = (Iu16vec4) a; }
/* Logical Assignment Operators */
Iu16vec4& operator&=(const M64 &a) { return *this = (Iu16vec4) _m_pand(vec,a); }
Iu16vec4& operator|=(const M64 &a) { return *this = (Iu16vec4) _m_por(vec,a); }
Iu16vec4& operator^=(const M64 &a) { return *this = (Iu16vec4) _m_pxor(vec,a); }
/* Addition & Subtraction Assignment Operators */
Iu16vec4& operator +=(const I16vec4 &a) { return *this = (Iu16vec4)_m_paddw(vec,a); }
Iu16vec4& operator -=(const I16vec4 &a) { return *this = (Iu16vec4)_m_psubw(vec,a); }
Iu16vec4& operator *=(const I16vec4 &a) { return *this = (Iu16vec4)_m_pmullw(vec,a); }
/* Shift Logical Operators */
Iu16vec4 operator<<(const M64 &a) { return _m_psllw(vec,a); }
Iu16vec4 operator<<(int count) { return _m_psllwi(vec,count); }
Iu16vec4& operator<<=(const M64 &a) { return *this = (Iu16vec4)_m_psllw(vec,a); }
Iu16vec4& operator<<=(int count) { return *this = (Iu16vec4)_m_psllwi(vec,count); }
Iu16vec4 operator>>(const M64 &a) { return _m_psrlw(vec,a); }
Iu16vec4 operator>>(int count) { return _m_psrlwi(vec,count); }
Iu16vec4& operator>>=(const M64 &a) { return *this = (Iu16vec4) _m_psrlw(vec,a); }
Iu16vec4& operator>>=(int count) { return *this = (Iu16vec4) _m_psrlwi(vec,count); }
#if defined (_ENABLE_VEC_DEBUG)
/* Output for Debug */
friend std::ostream& operator<< (std::ostream &os, const Iu16vec4 &a)
{
os << "[3]:" << _MM_4UW(3,a)
<< " [2]:" << _MM_4UW(2,a)
<< " [1]:" << _MM_4UW(1,a)
<< " [0]:" << _MM_4UW(0,a);
return os;
}
#endif /* defined (_ENABLE_VEC_DEBUG) */
/* Element Access for Debug, No data modified */
const unsigned short& operator[](int i)const
{
_VEC_ASSERT(static_cast<unsigned int>(i) < 4); /* Only 4 elements to access */
return _MM_4UW(i,vec);
}
/* Element Access and Assignment for Debug */
unsigned short& operator[](int i)
{
_VEC_ASSERT(static_cast<unsigned int>(i) < 4); /* Only 4 elements to access */
return _MM_4UW(i,vec);
}
};
inline Iu16vec4 operator*(const Iu16vec4 &a, const Iu16vec4 &b) { return _m_pmullw(a,b); }
inline Iu16vec4 cmpeq(const Iu16vec4 &a, const Iu16vec4 &b) { return _m_pcmpeqw(a,b); }
inline Iu16vec4 cmpneq(const Iu16vec4 &a, const Iu16vec4 &b) { return _m_pandn(_m_pcmpeqw(a,b), M64(0xffffffffffffffffi64)); }
inline Iu16vec4 sat_add(const Iu16vec4 &a, const Iu16vec4 &b) { return _m_paddusw(a,b); }
inline Iu16vec4 sat_sub(const Iu16vec4 &a, const Iu16vec4 &b) { return _m_psubusw(a,b); }
inline Iu16vec4 unpack_low(const Iu16vec4 &a, const Iu16vec4 &b) { return _m_punpcklwd(a,b); }
inline Iu16vec4 unpack_high(const Iu16vec4 &a, const Iu16vec4 &b) { return _m_punpckhwd(a,b); }
/* I8vec8 Class:
* 8 elements, each element either unsigned or signed char
*/
class I8vec8 : public M64
{
public:
I8vec8() { }
I8vec8(__m64 mm) : M64(mm) { }
explicit I8vec8(__int64 i) : M64 (i) { }
explicit I8vec8(int i) : M64 (i) { }
/* Assignment Operator */
I8vec8& operator= (const M64 &a) { return *this = (I8vec8) a; }
/* Logical Assignment Operators */
I8vec8& operator&=(const M64 &a) { return *this = (I8vec8) _m_pand(vec,a); }
I8vec8& operator|=(const M64 &a) { return *this = (I8vec8) _m_por(vec,a); }
I8vec8& operator^=(const M64 &a) { return *this = (I8vec8) _m_pxor(vec,a); }
/* Addition & Subtraction Assignment Operators */
I8vec8& operator +=(const I8vec8 &a) { return *this = (I8vec8) _m_paddb(vec,a); }
I8vec8& operator -=(const I8vec8 &a) { return *this = (I8vec8) _m_psubb(vec,a); }
};
inline I8vec8 cmpeq(const I8vec8 &a, const I8vec8 &b) { return _m_pcmpeqb(a,b); }
inline I8vec8 cmpneq(const I8vec8 &a, const I8vec8 &b) { return _m_pandn(_m_pcmpeqb(a,b), M64(0xffffffffffffffffi64)); }
inline I8vec8 unpack_low(const I8vec8 &a, const I8vec8 &b) { return _m_punpcklbw(a,b); }
inline I8vec8 unpack_high(const I8vec8 &a, const I8vec8 &b) { return _m_punpckhbw(a,b); }
/* Is8vec8 Class:
* 8 elements, each element signed char
*/
class Is8vec8 : public I8vec8
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -