Skip to content

Commit 9f9d69b

Browse files
authored
Fixes for __lce_alg_picker
Fixes _OverflowOK and the static_assert to actually check for what they're intended to check.
1 parent 8b0f47b commit 9f9d69b

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

libcxx/include/__random/linear_congruential_engine.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,10 @@ template <unsigned long long __a,
3131
unsigned long long __m,
3232
unsigned long long _Mp,
3333
bool _MightOverflow = (__a != 0 && __m != 0 && __m - 1 > (_Mp - __c) / __a),
34-
bool _OverflowOK = ((__m | (__m - 1)) > __m), // m = 2^n
35-
bool _SchrageOK = (__a != 0 && __m != 0 && __m % __a <= __m / __a)> // r <= q
34+
bool _OverflowOK = ((__m & (__m - 1)) == 0ull), // m = 2^n
35+
bool _SchrageOK = (__a != 0 && __m != 0 && __m % __a <= __m / __a)> // r <= q
3636
struct __lce_alg_picker {
37-
static_assert(__a != 0 || __m != 0 || !_MightOverflow || _OverflowOK || _SchrageOK,
37+
static_assert(!_MightOverflow || _OverflowOK || _SchrageOK,
3838
"The current values of a, c, and m cannot generate a number "
3939
"within bounds of linear_congruential_engine.");
4040

0 commit comments

Comments
 (0)