mirror of
https://gitlab.com/libeigen/eigen.git
synced 2026-04-10 11:34:33 +08:00
Suppress Warray-bounds warning in generic ploaduSegment, fix edge case for vectorized cast
This commit is contained in:
@@ -1596,9 +1596,10 @@ EIGEN_DEVICE_FUNC inline Packet ploaduSegment(const typename unpacket_traits<Pac
|
||||
using Scalar = typename unpacket_traits<Packet>::type;
|
||||
constexpr Index PacketSize = unpacket_traits<Packet>::size;
|
||||
eigen_assert((begin >= 0 && count >= 0 && begin + count <= PacketSize) && "invalid range");
|
||||
Scalar aux[PacketSize];
|
||||
memset(static_cast<void*>(aux), 0x00, sizeof(Scalar) * PacketSize);
|
||||
smart_copy(from + begin, from + begin + count, aux + begin);
|
||||
Scalar aux[PacketSize] = {};
|
||||
for (Index k = begin; k < begin + count; k++) {
|
||||
aux[k] = from[k];
|
||||
}
|
||||
return ploadu<Packet>(aux);
|
||||
}
|
||||
|
||||
@@ -1619,7 +1620,9 @@ EIGEN_DEVICE_FUNC inline void pstoreuSegment(Scalar* to, const Packet& from, Ind
|
||||
eigen_assert((begin >= 0 && count >= 0 && begin + count <= PacketSize) && "invalid range");
|
||||
Scalar aux[PacketSize];
|
||||
pstoreu<Scalar, Packet>(aux, from);
|
||||
smart_copy(aux + begin, aux + begin + count, to + begin);
|
||||
for (Index k = begin; k < begin + count; k++) {
|
||||
to[k] = aux[k];
|
||||
}
|
||||
}
|
||||
|
||||
/** \internal copy the packet \a from in the range [begin, begin + count) to \a *to.
|
||||
|
||||
Reference in New Issue
Block a user