diff options
author | chai <chaifix@163.com> | 2019-08-14 22:50:43 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2019-08-14 22:50:43 +0800 |
commit | 15740faf9fe9fe4be08965098bbf2947e096aeeb (patch) | |
tree | a730ec236656cc8cab5b13f088adfaed6bb218fb /Runtime/Math/Simd/bool1.h |
Diffstat (limited to 'Runtime/Math/Simd/bool1.h')
-rw-r--r-- | Runtime/Math/Simd/bool1.h | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/Runtime/Math/Simd/bool1.h b/Runtime/Math/Simd/bool1.h new file mode 100644 index 0000000..d195a4c --- /dev/null +++ b/Runtime/Math/Simd/bool1.h @@ -0,0 +1,42 @@ +#ifndef SIMD_BOOL1_H +#define SIMD_BOOL1_H + +#include "Runtime/Math/Simd/intrinsic.h" + +namespace math +{ + +struct ATTRIBUTE_ALIGN(ALIGN4F) bool1 +{ + enum { + RHS_SWZ = kXYZW + }; + + typedef bool scalar_type; + typedef vec4bs packed_type; + + packed_type s; + + MECANIM_FORCE_INLINE bool1() + {} + + MECANIM_FORCE_INLINE explicit bool1(packed_type x) : s(x) + {} + + MECANIM_FORCE_INLINE explicit bool1(scalar_type x) : s(Vloadsb(x)) + {} + + MECANIM_FORCE_INLINE operator scalar_type() const + { return Vstoresb(s); } + + MECANIM_FORCE_INLINE bool1 &operator=(const bool1 &r) + { s = r.s; return *this; } + + // unary operators + MECANIM_FORCE_INLINE bool1 operator!() const + { bool1 r = bool1(Vnot(s)); return r; } +}; + +} + +#endif |