This commit is contained in:
Charles Schlosser
2025-03-22 17:19:44 +00:00
parent ac2165c11f
commit 754bd24f5e
3 changed files with 54 additions and 3 deletions

View File

@@ -580,7 +580,7 @@ EIGEN_DEVICE_FUNC inline Packet pandnot(const Packet& a, const Packet& b) {
}
// In the general case, use bitwise select.
template <typename Packet, typename EnableIf = void>
template <typename Packet, bool is_scalar = is_scalar<Packet>::value>
struct pselect_impl {
static EIGEN_DEVICE_FUNC inline Packet run(const Packet& mask, const Packet& a, const Packet& b) {
return por(pand(a, mask), pandnot(b, mask));
@@ -589,9 +589,9 @@ struct pselect_impl {
// For scalars, use ternary select.
template <typename Packet>
struct pselect_impl<Packet, std::enable_if_t<is_scalar<Packet>::value>> {
struct pselect_impl<Packet, true> {
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;
return numext::select(mask, a, b);
}
};