diff options
author | Erik Kundiman <erik@megapahit.org> | 2025-06-23 06:40:16 +0800 |
---|---|---|
committer | Erik Kundiman <erik@megapahit.org> | 2025-06-23 06:40:16 +0800 |
commit | c4bbf2134ce541854498561a939bb29dfb058e04 (patch) | |
tree | 7e568ddc826dcc6f3d2e249cb4b6db0f65a3e02c /indra/llmath/llvector4a.cpp | |
parent | f5de250c3e74ecc8eb658d0b070c0884616f041d (diff) |
Fix "too many initializers" LLQuad initialisations
LLQuad is a typedef of __m128, which is already translated by
sse2neon to float32x4_t (I thought sse2neon wasn't taking effect
and I tried just replacing __m128 with float32x4_t to see that it
didn't make a difference), but then I searched using the keyword
float32x4_t this time and found that others have had a similar
problem:
https://developercommunity.visualstudio.com/t/static-initialization-arm64-neon-datatypes/1238406
https://stackoverflow.com/questions/54016821/error-c2078-when-initializing-uint32x4-t-on-arm
https://github.com/kcat/openal-soft/issues/494
Looking at the type definition, on arm64 it can be initialised
using a designator, the member with the float type and 4 array
elements.
I know it's an MSVC (arm64) problem, but since MSVC is also used
on x64 and only Windows arm64 is suffering from this one in our
case anyway (we only support Windows arm64 building using MSVC so
far), it's just simpler to use the _M_ARM64 preprocessor instead
of _MSC_VER.
Diffstat (limited to 'indra/llmath/llvector4a.cpp')
-rw-r--r-- | indra/llmath/llvector4a.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/indra/llmath/llvector4a.cpp b/indra/llmath/llvector4a.cpp index b81d50f0f9..df20585d16 100644 --- a/indra/llmath/llvector4a.cpp +++ b/indra/llmath/llvector4a.cpp @@ -30,6 +30,15 @@ #include "llmath.h" #include "llquantize.h" +#if _M_ARM64 +extern const LLQuad F_ZERO_4A = {.n128_f32 = {0, 0, 0, 0}}; +extern const LLQuad F_APPROXIMATELY_ZERO_4A = {.n128_f32 = { + F_APPROXIMATELY_ZERO, + F_APPROXIMATELY_ZERO, + F_APPROXIMATELY_ZERO, + F_APPROXIMATELY_ZERO +}}; +#else extern const LLQuad F_ZERO_4A = { 0, 0, 0, 0 }; extern const LLQuad F_APPROXIMATELY_ZERO_4A = { F_APPROXIMATELY_ZERO, @@ -37,6 +46,7 @@ extern const LLQuad F_APPROXIMATELY_ZERO_4A = { F_APPROXIMATELY_ZERO, F_APPROXIMATELY_ZERO }; +#endif extern const LLVector4a LL_V4A_ZERO = reinterpret_cast<const LLVector4a&> ( F_ZERO_4A ); extern const LLVector4a LL_V4A_EPSILON = reinterpret_cast<const LLVector4a&> ( F_APPROXIMATELY_ZERO_4A ); |