mirror of https://github.com/zeldaret/botw.git
Havok: Add hkSimdFloat32 comparisons
This commit is contained in:
parent
a85b90ec26
commit
55eb07087c
|
@ -2,6 +2,8 @@
|
|||
|
||||
#include <Havok/Common/Base/Types/hkBaseTypes.h>
|
||||
|
||||
#include <Havok/Common/Base/Math/Vector/hkVector4fComparison.h>
|
||||
|
||||
#ifdef __aarch64__
|
||||
#include <arm_neon.h>
|
||||
#define HK_SIMD_FLOAT32_AARCH64_NEON
|
||||
|
@ -72,11 +74,44 @@ public:
|
|||
/// Return the inverse square root. Does not check if the value is negative or zero.
|
||||
HK_FORCE_INLINE hkSimdFloat32 sqrtInverseUnsafe() const;
|
||||
|
||||
HK_FORCE_INLINE hkBool32 isLess(hkSimdFloat32Parameter a) const;
|
||||
HK_FORCE_INLINE hkBool32 isLessEqual(hkSimdFloat32Parameter a) const;
|
||||
HK_FORCE_INLINE hkBool32 isGreater(hkSimdFloat32Parameter a) const;
|
||||
HK_FORCE_INLINE hkBool32 isGreaterEqual(hkSimdFloat32Parameter a) const;
|
||||
HK_FORCE_INLINE hkBool32 isEqual(hkSimdFloat32Parameter a) const;
|
||||
HK_FORCE_INLINE hkBool32 isNotEqual(hkSimdFloat32Parameter a) const;
|
||||
HK_FORCE_INLINE hkBool32 isLessZero() const;
|
||||
HK_FORCE_INLINE hkBool32 isLessEqualZero() const;
|
||||
HK_FORCE_INLINE hkBool32 isGreaterZero() const;
|
||||
HK_FORCE_INLINE hkBool32 isGreaterEqualZero() const;
|
||||
HK_FORCE_INLINE hkBool32 isEqualZero() const;
|
||||
HK_FORCE_INLINE hkBool32 isNotEqualZero() const;
|
||||
|
||||
HK_FORCE_INLINE hkVector4fComparison less(hkSimdFloat32Parameter a) const;
|
||||
HK_FORCE_INLINE hkVector4fComparison lessEqual(hkSimdFloat32Parameter a) const;
|
||||
HK_FORCE_INLINE hkVector4fComparison greater(hkSimdFloat32Parameter a) const;
|
||||
HK_FORCE_INLINE hkVector4fComparison greaterEqual(hkSimdFloat32Parameter a) const;
|
||||
HK_FORCE_INLINE hkVector4fComparison equal(hkSimdFloat32Parameter a) const;
|
||||
HK_FORCE_INLINE hkVector4fComparison notEqual(hkSimdFloat32Parameter a) const;
|
||||
HK_FORCE_INLINE hkVector4fComparison lessZero() const;
|
||||
HK_FORCE_INLINE hkVector4fComparison lessEqualZero() const;
|
||||
HK_FORCE_INLINE hkVector4fComparison greaterZero() const;
|
||||
HK_FORCE_INLINE hkVector4fComparison greaterEqualZero() const;
|
||||
HK_FORCE_INLINE hkVector4fComparison equalZero() const;
|
||||
HK_FORCE_INLINE hkVector4fComparison notEqualZero() const;
|
||||
|
||||
HK_FORCE_INLINE m128 toQuad() const;
|
||||
|
||||
Storage m_real;
|
||||
|
||||
private:
|
||||
static hkVector4fComparison toComparison(const Storage& v) {
|
||||
#ifdef HK_SIMD_FLOAT32_AARCH64_NEON
|
||||
return hkVector4fComparison::convert(vcombine_f32(v, v));
|
||||
#else
|
||||
return hkVector4fComparison::convert(v);
|
||||
#endif
|
||||
}
|
||||
};
|
||||
|
||||
template <int Constant>
|
||||
|
@ -230,11 +265,126 @@ inline hkSimdFloat32 hkSimdFloat32::sqrtInverseUnsafe() const {
|
|||
#endif
|
||||
}
|
||||
|
||||
inline hkBool32 hkSimdFloat32::isLess(hkSimdFloat32Parameter a) const {
|
||||
auto cmp = m_real < a.m_real;
|
||||
return cmp[0];
|
||||
}
|
||||
|
||||
inline hkBool32 hkSimdFloat32::isLessEqual(hkSimdFloat32Parameter a) const {
|
||||
auto cmp = m_real <= a.m_real;
|
||||
return cmp[0];
|
||||
}
|
||||
|
||||
inline hkBool32 hkSimdFloat32::isGreater(hkSimdFloat32Parameter a) const {
|
||||
auto cmp = m_real > a.m_real;
|
||||
return cmp[0];
|
||||
}
|
||||
|
||||
inline hkBool32 hkSimdFloat32::isGreaterEqual(hkSimdFloat32Parameter a) const {
|
||||
auto cmp = m_real >= a.m_real;
|
||||
return cmp[0];
|
||||
}
|
||||
|
||||
inline hkBool32 hkSimdFloat32::isEqual(hkSimdFloat32Parameter a) const {
|
||||
auto cmp = m_real == a.m_real;
|
||||
return cmp[0];
|
||||
}
|
||||
|
||||
inline hkBool32 hkSimdFloat32::isNotEqual(hkSimdFloat32Parameter a) const {
|
||||
auto cmp = m_real != a.m_real;
|
||||
return cmp[0];
|
||||
}
|
||||
|
||||
inline hkBool32 hkSimdFloat32::isLessZero() const {
|
||||
auto cmp = m_real < 0.0;
|
||||
return cmp[0];
|
||||
}
|
||||
|
||||
inline hkBool32 hkSimdFloat32::isLessEqualZero() const {
|
||||
auto cmp = m_real <= 0.0;
|
||||
return cmp[0];
|
||||
}
|
||||
|
||||
inline hkBool32 hkSimdFloat32::isGreaterZero() const {
|
||||
auto cmp = m_real > 0.0;
|
||||
return cmp[0];
|
||||
}
|
||||
|
||||
inline hkBool32 hkSimdFloat32::isGreaterEqualZero() const {
|
||||
auto cmp = m_real >= 0.0;
|
||||
return cmp[0];
|
||||
}
|
||||
|
||||
inline hkBool32 hkSimdFloat32::isEqualZero() const {
|
||||
auto cmp = m_real == 0.0;
|
||||
return cmp[0];
|
||||
}
|
||||
|
||||
inline hkBool32 hkSimdFloat32::isNotEqualZero() const {
|
||||
auto cmp = m_real != 0.0;
|
||||
return cmp[0];
|
||||
}
|
||||
|
||||
inline hkVector4fComparison hkSimdFloat32::less(hkSimdFloat32Parameter a) const {
|
||||
auto cmp = m_real < a.m_real;
|
||||
return toComparison(cmp);
|
||||
}
|
||||
|
||||
inline hkVector4fComparison hkSimdFloat32::lessEqual(hkSimdFloat32Parameter a) const {
|
||||
auto cmp = m_real <= a.m_real;
|
||||
return toComparison(cmp);
|
||||
}
|
||||
|
||||
inline hkVector4fComparison hkSimdFloat32::greater(hkSimdFloat32Parameter a) const {
|
||||
auto cmp = m_real > a.m_real;
|
||||
return toComparison(cmp);
|
||||
}
|
||||
|
||||
inline hkVector4fComparison hkSimdFloat32::greaterEqual(hkSimdFloat32Parameter a) const {
|
||||
auto cmp = m_real >= a.m_real;
|
||||
return toComparison(cmp);
|
||||
}
|
||||
|
||||
inline hkVector4fComparison hkSimdFloat32::equal(hkSimdFloat32Parameter a) const {
|
||||
auto cmp = m_real == a.m_real;
|
||||
return toComparison(cmp);
|
||||
}
|
||||
|
||||
inline hkVector4fComparison hkSimdFloat32::notEqual(hkSimdFloat32Parameter a) const {
|
||||
auto cmp = m_real != a.m_real;
|
||||
return toComparison(cmp);
|
||||
}
|
||||
|
||||
inline hkVector4fComparison hkSimdFloat32::lessZero() const {
|
||||
auto cmp = m_real < 0.0;
|
||||
return toComparison(cmp);
|
||||
}
|
||||
|
||||
inline hkVector4fComparison hkSimdFloat32::lessEqualZero() const {
|
||||
auto cmp = m_real <= 0.0;
|
||||
return toComparison(cmp);
|
||||
}
|
||||
|
||||
inline hkVector4fComparison hkSimdFloat32::greaterZero() const {
|
||||
auto cmp = m_real > 0.0;
|
||||
return toComparison(cmp);
|
||||
}
|
||||
|
||||
inline hkVector4fComparison hkSimdFloat32::greaterEqualZero() const {
|
||||
auto cmp = m_real >= 0.0;
|
||||
return toComparison(cmp);
|
||||
}
|
||||
|
||||
inline hkVector4fComparison hkSimdFloat32::equalZero() const {
|
||||
auto cmp = m_real == 0.0;
|
||||
return toComparison(cmp);
|
||||
}
|
||||
|
||||
inline hkVector4fComparison hkSimdFloat32::notEqualZero() const {
|
||||
auto cmp = m_real != 0.0;
|
||||
return toComparison(cmp);
|
||||
}
|
||||
|
||||
inline m128 hkSimdFloat32::toQuad() const {
|
||||
#ifdef HK_SIMD_FLOAT32_AARCH64_NEON
|
||||
return vcombine_f32(m_real, m_real);
|
||||
|
|
Loading…
Reference in New Issue