simd constexpr vec: fix yet another compiler error #3

This commit is contained in:
sharkautarch 2024-10-08 11:32:27 -04:00
parent 465bf42a8e
commit aca39699af
No known key found for this signature in database
GPG Key ID: F270CA9462164405

View File

@ -187,10 +187,31 @@ namespace glm
template <typename Tx, qualifier Qx> requires(std::is_same_v<T, bool>) template <typename Tx, qualifier Qx> requires(std::is_same_v<T, bool>)
inline vec<L, Tx, Qx> compWiseTernary(vec<L, Tx, Qx> v1, vec<L, Tx, Qx> v2) { inline vec<L, Tx, Qx> compWiseTernary(vec<L, Tx, Qx> v1, vec<L, Tx, Qx> v2) {
GccVec_t condMask = std::bit_cast<GccVec_t>(elementArr); if constexpr ( sizeof(Tx) == sizeof(int32_t) ) {
using GVec_t = typename detail::GccVExt<L, int32_t, Q>::GccV;
GVec_t condMask = __builtin_convertvector(std::bit_cast<GccVec_t>(elementArr), GVec_t);
auto gv1 = std::bit_cast<GccVec<L, Tx, Qx>>(v1.elementArr); auto gv1 = std::bit_cast<GccVec<L, Tx, Qx>>(v1.elementArr);
auto gv2 = std::bit_cast<GccVec<L, Tx, Qx>>(v2.elementArr); auto gv2 = std::bit_cast<GccVec<L, Tx, Qx>>(v2.elementArr);
return vec<L, Tx, Qx>((condMask ? gv1 : gv2)); return vec<L, Tx, Qx>((condMask ? gv1 : gv2));
} else if constexpr ( sizeof(Tx) == sizeof(int64_t) ) {
using GVec_t = typename detail::GccVExt<L, int64_t, Q>::GccV;
GVec_t condMask = __builtin_convertvector(std::bit_cast<GccVec_t>(elementArr), GVec_t);
auto gv1 = std::bit_cast<GccVec<L, Tx, Qx>>(v1.elementArr);
auto gv2 = std::bit_cast<GccVec<L, Tx, Qx>>(v2.elementArr);
return vec<L, Tx, Qx>((condMask ? gv1 : gv2));
} else if constexpr ( sizeof(Tx) == sizeof(int16_t) ) {
using GVec_t = typename detail::GccVExt<L, int16_t, Q>::GccV;
GVec_t condMask = __builtin_convertvector(std::bit_cast<GccVec_t>(elementArr), GVec_t);
auto gv1 = std::bit_cast<GccVec<L, Tx, Qx>>(v1.elementArr);
auto gv2 = std::bit_cast<GccVec<L, Tx, Qx>>(v2.elementArr);
return vec<L, Tx, Qx>((condMask ? gv1 : gv2));
} else {
using GVec_t = typename detail::GccVExt<L, int8_t, Q>::GccV;
GVec_t condMask = __builtin_convertvector(std::bit_cast<GccVec_t>(elementArr), GVec_t);
auto gv1 = std::bit_cast<GccVec<L, Tx, Qx>>(v1.elementArr);
auto gv2 = std::bit_cast<GccVec<L, Tx, Qx>>(v2.elementArr);
return vec<L, Tx, Qx>((condMask ? gv1 : gv2));
}
} }
template <typename ScalarGetter> template <typename ScalarGetter>