mirror of https://github.com/zeldaret/botw.git
Havok: Simplify hkSimdFloat32 by always using a vector type
This commit is contained in:
parent
5c55811abd
commit
a40ef6c860
|
@ -16,22 +16,21 @@ public:
|
||||||
#ifdef HK_SIMD_FLOAT32_AARCH64_NEON
|
#ifdef HK_SIMD_FLOAT32_AARCH64_NEON
|
||||||
using Storage = __attribute__((vector_size(2 * sizeof(float)))) float;
|
using Storage = __attribute__((vector_size(2 * sizeof(float)))) float;
|
||||||
#else
|
#else
|
||||||
using Storage = float;
|
using Storage = __attribute__((vector_size(4 * sizeof(float)))) float;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
hkSimdFloat32() = default;
|
hkSimdFloat32() = default;
|
||||||
|
// NOLINTNEXTLINE(google-explicit-constructor)
|
||||||
|
hkSimdFloat32(const Storage& x) { m_real = x; }
|
||||||
|
|
||||||
#ifdef HK_SIMD_FLOAT32_AARCH64_NEON
|
#ifdef HK_SIMD_FLOAT32_AARCH64_NEON
|
||||||
// NOLINTNEXTLINE(google-explicit-constructor)
|
// NOLINTNEXTLINE(google-explicit-constructor)
|
||||||
hkSimdFloat32(const float& x) { m_real = vdup_n_f32(x); }
|
hkSimdFloat32(const float& x) { m_real = vdup_n_f32(x); }
|
||||||
// NOLINTNEXTLINE(google-explicit-constructor)
|
|
||||||
hkSimdFloat32(const Storage& x) { m_real = x; }
|
|
||||||
hkFloat32 val() const { return m_real[0]; }
|
|
||||||
#else
|
#else
|
||||||
hkSimdFloat32(float x) : m_real{x} {} // NOLINT(google-explicit-constructor)
|
hkSimdFloat32(float x) : m_real{x, x, x, x} {} // NOLINT(google-explicit-constructor)
|
||||||
hkFloat32 val() const { return m_real; }
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
hkFloat32 val() const { return m_real[0]; }
|
||||||
operator float() const { return val(); } // NOLINT(google-explicit-constructor)
|
operator float() const { return val(); } // NOLINT(google-explicit-constructor)
|
||||||
|
|
||||||
template <int Constant>
|
template <int Constant>
|
||||||
|
@ -55,6 +54,7 @@ inline void hkSimdFloat32::setAbs(hkSimdFloat32Parameter x) {
|
||||||
#ifdef HK_SIMD_FLOAT32_AARCH64_NEON
|
#ifdef HK_SIMD_FLOAT32_AARCH64_NEON
|
||||||
m_real = vabs_f32(m_real);
|
m_real = vabs_f32(m_real);
|
||||||
#else
|
#else
|
||||||
m_real = std::abs(x.m_real);
|
for (int i = 0; i < 4; ++i)
|
||||||
|
m_real[i] = std::abs(x.m_real[i]);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue