vec128 bitwise operators
This commit is contained in:
parent
9c93fa5187
commit
0cf6e166a1
|
@ -105,12 +105,54 @@ typedef struct alignas(16) vec128_s {
|
|||
};
|
||||
};
|
||||
|
||||
vec128_s() = default;
|
||||
vec128_s(const vec128_s& other) {
|
||||
high = other.high;
|
||||
low = other.low;
|
||||
}
|
||||
|
||||
vec128_s& operator=(const vec128_s& b) {
|
||||
high = b.high;
|
||||
low = b.low;
|
||||
return *this;
|
||||
}
|
||||
|
||||
bool operator==(const vec128_s& b) const {
|
||||
return low == b.low && high == b.high;
|
||||
}
|
||||
bool operator!=(const vec128_s& b) const {
|
||||
return low != b.low || high != b.high;
|
||||
}
|
||||
vec128_s operator^(const vec128_s& b) const {
|
||||
vec128_s a = *this;
|
||||
a.high ^= b.high;
|
||||
a.low ^= b.low;
|
||||
return a;
|
||||
};
|
||||
vec128_s& operator^=(const vec128_s& b) {
|
||||
*this = *this ^ b;
|
||||
return *this;
|
||||
};
|
||||
vec128_s operator&(const vec128_s& b) const {
|
||||
vec128_s a = *this;
|
||||
a.high &= b.high;
|
||||
a.low &= b.low;
|
||||
return a;
|
||||
};
|
||||
vec128_s& operator&=(const vec128_s& b) {
|
||||
*this = *this & b;
|
||||
return *this;
|
||||
};
|
||||
vec128_s operator|(const vec128_s& b) const {
|
||||
vec128_s a = *this;
|
||||
a.high |= b.high;
|
||||
a.low |= b.low;
|
||||
return a;
|
||||
};
|
||||
vec128_s& operator|=(const vec128_s& b) {
|
||||
*this = *this | b;
|
||||
return *this;
|
||||
};
|
||||
} vec128_t;
|
||||
|
||||
static inline vec128_t vec128i(uint32_t src) {
|
||||
|
|
Loading…
Reference in New Issue