diff --git a/Eigen/src/Core/GenericPacketMath.h b/Eigen/src/Core/GenericPacketMath.h index b02a9f20b..7160fa084 100644 --- a/Eigen/src/Core/GenericPacketMath.h +++ b/Eigen/src/Core/GenericPacketMath.h @@ -266,37 +266,43 @@ EIGEN_DEVICE_FUNC inline Packet bitwise_helper(const Packet& a, const Packet& b, return c; } +template +struct bit_and { + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR EIGEN_ALWAYS_INLINE T operator()(const T& a, const T& b) const { + return a & b; + } +}; + +template +struct bit_or { + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR EIGEN_ALWAYS_INLINE T operator()(const T& a, const T& b) const { + return a | b; + } +}; + +template +struct bit_xor { + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR EIGEN_ALWAYS_INLINE T operator()(const T& a, const T& b) const { + return a ^ b; + } +}; + /** \internal \returns the bitwise and of \a a and \a b */ template EIGEN_DEVICE_FUNC inline Packet pand(const Packet& a, const Packet& b) { -#if defined(EIGEN_HIP_DEVICE_COMPILE) - return bitwise_helper(a ,b, std::bit_and()); -#else - EIGEN_USING_STD(bit_and); - return bitwise_helper(a ,b, bit_and()); -#endif + return bitwise_helper(a, b, bit_and()); } /** \internal \returns the bitwise or of \a a and \a b */ template EIGEN_DEVICE_FUNC inline Packet por(const Packet& a, const Packet& b) { -#if defined(EIGEN_HIP_DEVICE_COMPILE) - return bitwise_helper(a ,b, std::bit_or()); -#else - EIGEN_USING_STD(bit_or); return bitwise_helper(a ,b, bit_or()); -#endif } /** \internal \returns the bitwise xor of \a a and \a b */ template EIGEN_DEVICE_FUNC inline Packet pxor(const Packet& a, const Packet& b) { -#if defined(EIGEN_HIP_DEVICE_COMPILE) - return bitwise_helper(a ,b, std::bit_xor()); -#else - EIGEN_USING_STD(bit_xor); return bitwise_helper(a ,b, bit_xor()); -#endif } /** \internal \returns the bitwise and of \a a and not \a b */