From aca39699afe3a6064e60dcb7c7a1f367398f56ec Mon Sep 17 00:00:00 2001 From: sharkautarch <128002472+sharkautarch@users.noreply.github.com> Date: Tue, 8 Oct 2024 11:32:27 -0400 Subject: [PATCH] simd constexpr vec: fix yet another compiler error #3 --- glm/detail/simd_constexpr/vec.hpp | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/glm/detail/simd_constexpr/vec.hpp b/glm/detail/simd_constexpr/vec.hpp index 4c60c291..a686e280 100644 --- a/glm/detail/simd_constexpr/vec.hpp +++ b/glm/detail/simd_constexpr/vec.hpp @@ -187,10 +187,31 @@ namespace glm template requires(std::is_same_v) inline vec compWiseTernary(vec v1, vec v2) { - GccVec_t condMask = std::bit_cast(elementArr); - auto gv1 = std::bit_cast>(v1.elementArr); - auto gv2 = std::bit_cast>(v2.elementArr); - return vec((condMask ? gv1 : gv2)); + if constexpr ( sizeof(Tx) == sizeof(int32_t) ) { + using GVec_t = typename detail::GccVExt::GccV; + GVec_t condMask = __builtin_convertvector(std::bit_cast(elementArr), GVec_t); + auto gv1 = std::bit_cast>(v1.elementArr); + auto gv2 = std::bit_cast>(v2.elementArr); + return vec((condMask ? gv1 : gv2)); + } else if constexpr ( sizeof(Tx) == sizeof(int64_t) ) { + using GVec_t = typename detail::GccVExt::GccV; + GVec_t condMask = __builtin_convertvector(std::bit_cast(elementArr), GVec_t); + auto gv1 = std::bit_cast>(v1.elementArr); + auto gv2 = std::bit_cast>(v2.elementArr); + return vec((condMask ? gv1 : gv2)); + } else if constexpr ( sizeof(Tx) == sizeof(int16_t) ) { + using GVec_t = typename detail::GccVExt::GccV; + GVec_t condMask = __builtin_convertvector(std::bit_cast(elementArr), GVec_t); + auto gv1 = std::bit_cast>(v1.elementArr); + auto gv2 = std::bit_cast>(v2.elementArr); + return vec((condMask ? gv1 : gv2)); + } else { + using GVec_t = typename detail::GccVExt::GccV; + GVec_t condMask = __builtin_convertvector(std::bit_cast(elementArr), GVec_t); + auto gv1 = std::bit_cast>(v1.elementArr); + auto gv2 = std::bit_cast>(v2.elementArr); + return vec((condMask ? gv1 : gv2)); + } } template