mirror of
https://github.com/g-truc/glm.git
synced 2024-11-29 19:34:36 +00:00
constexpr simd vec: mixed element type constructor: fix nullptr being passed to memcpy
This commit is contained in:
parent
3e20cc6654
commit
d5f8676b3a
@ -295,7 +295,7 @@ namespace glm
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
static inline auto ctor_mixed_constexpr_single = [](auto vs0) -> auto
|
static inline decltype(auto) ctor_mixed_constexpr_single = [](auto vs0) -> auto
|
||||||
{
|
{
|
||||||
using VTX = decltype(vs0);
|
using VTX = decltype(vs0);
|
||||||
if constexpr ( std::is_integral_v<VTX> || std::is_floating_point_v<VTX> ) {
|
if constexpr ( std::is_integral_v<VTX> || std::is_floating_point_v<VTX> ) {
|
||||||
@ -353,16 +353,19 @@ namespace glm
|
|||||||
const auto params = std::tuple{vecOrScalar...};
|
const auto params = std::tuple{vecOrScalar...};
|
||||||
|
|
||||||
const auto arr = ctor_mixed_constexpr_single(std::get<0>(params));
|
const auto arr = ctor_mixed_constexpr_single(std::get<0>(params));
|
||||||
std::memcpy(aa.a.p.begin()+i, arr, sizeof(T)*lengths[0]);
|
if (arr) [[likely]]
|
||||||
|
std::memcpy(aa.a.p.begin()+i, arr, sizeof(T)*lengths[0]);
|
||||||
constexpr auto i2 = i + lengths[0];
|
constexpr auto i2 = i + lengths[0];
|
||||||
|
|
||||||
if constexpr (sizeof...(VecOrScalar) > 1) {
|
if constexpr (sizeof...(VecOrScalar) > 1) {
|
||||||
const auto arr2 = ctor_mixed_constexpr_single(std::get<1>(params));
|
const auto arr2 = ctor_mixed_constexpr_single(std::get<1>(params));
|
||||||
std::memcpy(aa.a.p.begin()+i2, arr2, sizeof(T)*lengths[1]);
|
if (arr2) [[likely]]
|
||||||
|
std::memcpy(aa.a.p.begin()+i2, arr2, sizeof(T)*lengths[1]);
|
||||||
constexpr auto i3 = i2 + lengths[1];
|
constexpr auto i3 = i2 + lengths[1];
|
||||||
if constexpr (sizeof...(VecOrScalar) > 2) {
|
if constexpr (sizeof...(VecOrScalar) > 2) {
|
||||||
const auto arr3 = ctor_mixed_constexpr_single(std::get<2>(params));
|
const auto arr3 = ctor_mixed_constexpr_single(std::get<2>(params));
|
||||||
std::memcpy(aa.a.p.begin()+i3, arr3, sizeof(T)*lengths[2]);
|
if (arr3) [[likely]]
|
||||||
|
std::memcpy(aa.a.p.begin()+i3, arr3, sizeof(T)*lengths[2]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user