Fix the fuzz

This commit is contained in:
Charles Schlosser 2024-02-07 04:52:19 +00:00 committed by Antonio Sánchez
parent 3ab8f48256
commit 431e4a913b

View File

@ -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();