From 431e4a913bcf7c37208361868b7e202a8a8f5e4d Mon Sep 17 00:00:00 2001 From: Charles Schlosser Date: Wed, 7 Feb 2024 04:52:19 +0000 Subject: [PATCH] Fix the fuzz --- Eigen/src/Core/MathFunctions.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Eigen/src/Core/MathFunctions.h b/Eigen/src/Core/MathFunctions.h index 3f5df7b41..75f8e5344 100644 --- a/Eigen/src/Core/MathFunctions.h +++ b/Eigen/src/Core/MathFunctions.h @@ -767,7 +767,7 @@ Scalar getRandomBits(int numRandomBits) { ScalarBits = sizeof(Scalar) * CHAR_BIT }; eigen_assert((numRandomBits >= 0) && (numRandomBits <= ScalarBits)); - const BitsType mask = BitsType(-1) >> (ScalarBits - numRandomBits); + const BitsType mask = BitsType(-1) >> ((ScalarBits - numRandomBits) & (ScalarBits - 1)); BitsType randomBits = BitsType(0); for (int shift = 0; shift < numRandomBits; shift += StdRandBits) { int r = std::rand();