mirror of
https://gitlab.com/libeigen/eigen.git
synced 2026-04-10 11:34:33 +08:00
Fix integer sanitizer issues in shifts and test ranges
libeigen/eigen!2320 Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
This commit is contained in:
@@ -1923,7 +1923,8 @@ EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE double fmod(const double& a, const double&
|
||||
|
||||
template <typename Scalar, typename Enable = std::enable_if_t<std::is_integral<Scalar>::value>>
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar logical_shift_left(const Scalar& a, int n) {
|
||||
return a << n;
|
||||
using UnsignedScalar = typename numext::get_integer_by_size<sizeof(Scalar)>::unsigned_type;
|
||||
return bit_cast<Scalar, UnsignedScalar>(bit_cast<UnsignedScalar, Scalar>(a) << n);
|
||||
}
|
||||
|
||||
template <typename Scalar, typename Enable = std::enable_if_t<std::is_integral<Scalar>::value>>
|
||||
|
||||
Reference in New Issue
Block a user