simd constexpr vec: compWiseTernary, swizzle functions: construct the vec-to-return directly from the GccVec thingy

This commit is contained in:
sharkautarch 2024-10-06 13:37:27 -04:00
parent 4f5d589ecc
commit 55a64cf2ae
No known key found for this signature in database
GPG Key ID: F270CA9462164405
2 changed files with 3 additions and 3 deletions

View File

@ -8,7 +8,7 @@
G vin; std::memcpy(&vin, &data, std::min(sizeof(data), sizeof(vin))); \ G vin; std::memcpy(&vin, &data, std::min(sizeof(data), sizeof(vin))); \
GccVec<2, T, Q> vout; \ GccVec<2, T, Q> vout; \
vout = __builtin_shufflevector(vin, vin, offsetof(E, A)/sizeof(A), offsetof(E, B)/sizeof(B)); \ vout = __builtin_shufflevector(vin, vin, offsetof(E, A)/sizeof(A), offsetof(E, B)/sizeof(B)); \
return vec<2, T, Q>(std::bit_cast<typename vec<2, T, Q>::data_t>(vout)); \ return vec<2, T, Q>(vout); \
} }
#define GLM_SWIZZLE_GEN_VEC3_ENTRY(L, T, Q, CONST, A, B, C) \ #define GLM_SWIZZLE_GEN_VEC3_ENTRY(L, T, Q, CONST, A, B, C) \
@ -31,7 +31,7 @@
G vin; std::memcpy(&vin, &data, std::min(sizeof(data), sizeof(vin))); \ G vin; std::memcpy(&vin, &data, std::min(sizeof(data), sizeof(vin))); \
GccVec<4, T, Q> vout; \ GccVec<4, T, Q> vout; \
vout=__builtin_shufflevector(vin, vin, offsetof(E, A)/sizeof(A), offsetof(E, B)/sizeof(B), offsetof(E, C)/sizeof(C), offsetof(E, D)/sizeof(D)); \ vout=__builtin_shufflevector(vin, vin, offsetof(E, A)/sizeof(A), offsetof(E, B)/sizeof(B), offsetof(E, C)/sizeof(C), offsetof(E, D)/sizeof(D)); \
return vec<4, T, Q>(std::bit_cast<typename vec<4, T, Q>::data_t>(vout)); \ return vec<4, T, Q>(vout); \
} }
#define GLM_SWIZZLE_GEN_VEC2_ENTRY_DEF(T, Q, L, CONST, A, B) \ #define GLM_SWIZZLE_GEN_VEC2_ENTRY_DEF(T, Q, L, CONST, A, B) \

View File

@ -189,7 +189,7 @@ namespace glm
GccVec_t condMask = std::bit_cast<GccVec_t>(elementArr); GccVec_t condMask = std::bit_cast<GccVec_t>(elementArr);
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>(std::bit_cast<detail::_data_t<L, Tx, Qx>> ((condMask ? gv1 : gv2))); return vec<L, Tx, Qx>((condMask ? gv1 : gv2));
} }
template <typename ScalarGetter> template <typename ScalarGetter>