Revert "fix scalar pselect"

This commit is contained in:
Charles Schlosser 2024-06-15 20:02:28 +00:00
parent b430eb31e2
commit 2fae4d7a77

View File

@ -580,13 +580,21 @@ EIGEN_DEVICE_FUNC inline Packet pandnot(const Packet& a, const Packet& b) {
} }
// In the general case, use bitwise select. // In the general case, use bitwise select.
template <typename Packet> template <typename Packet, typename EnableIf = void>
struct pselect_impl { struct pselect_impl {
static EIGEN_DEVICE_FUNC inline Packet run(const Packet& mask, const Packet& a, const Packet& b) { static EIGEN_DEVICE_FUNC inline Packet run(const Packet& mask, const Packet& a, const Packet& b) {
return por(pand(a, mask), pandnot(b, mask)); return por(pand(a, mask), pandnot(b, mask));
} }
}; };
// For scalars, use ternary select.
template <typename Packet>
struct pselect_impl<Packet, std::enable_if_t<is_scalar<Packet>::value>> {
static EIGEN_DEVICE_FUNC inline Packet run(const Packet& mask, const Packet& a, const Packet& b) {
return numext::equal_strict(mask, Packet(0)) ? b : a;
}
};
/** \internal \returns \a or \b for each field in packet according to \mask */ /** \internal \returns \a or \b for each field in packet according to \mask */
template <typename Packet> template <typename Packet>
EIGEN_DEVICE_FUNC inline Packet pselect(const Packet& mask, const Packet& a, const Packet& b) { EIGEN_DEVICE_FUNC inline Packet pselect(const Packet& mask, const Packet& a, const Packet& b) {