We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
<random>
uniform_int
1 parent 706b425 commit f89e70eCopy full SHA for f89e70e
stl/inc/random
@@ -2089,12 +2089,7 @@ private:
2089
static _Uty _Adjust(_Uty _Uval) noexcept { // convert signed ranges to unsigned ranges and vice versa
2090
if constexpr (is_signed_v<_Ty>) {
2091
constexpr _Uty _Adjuster = (static_cast<_Uty>(-1) >> 1) + 1; // 2^(N-1)
2092
-
2093
- if (_Uval < _Adjuster) {
2094
- return static_cast<_Uty>(_Uval + _Adjuster);
2095
- } else {
2096
- return static_cast<_Uty>(_Uval - _Adjuster);
2097
- }
+ return static_cast<_Uty>(_Uval ^ _Adjuster);
2098
} else { // _Ty is already unsigned, do nothing
2099
return _Uval;
2100
}
0 commit comments