From c4bbf2134ce541854498561a939bb29dfb058e04 Mon Sep 17 00:00:00 2001 From: Erik Kundiman Date: Mon, 23 Jun 2025 06:40:16 +0800 Subject: 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. --- indra/llmath/llvector4a.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'indra/llmath/llvector4a.cpp') 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 ( F_ZERO_4A ); extern const LLVector4a LL_V4A_EPSILON = reinterpret_cast ( F_APPROXIMATELY_ZERO_4A ); -- cgit v1.2.3