diff options
author | Marshall Clow <mclow.lists@gmail.com> | 2015-07-30 18:26:34 +0000 |
---|---|---|
committer | Marshall Clow <mclow.lists@gmail.com> | 2015-07-30 18:26:34 +0000 |
commit | a6438ca12a72efe147e74b6ea4698f696f52b969 (patch) | |
tree | 141dc1a501a9b4be362358b68e94df20195561ab /libcxx/include/algorithm | |
parent | e96b85166b6e7a7bb5256a0957ee83ffa132a2dc (diff) | |
download | llvm-a6438ca12a72efe147e74b6ea4698f696f52b969.zip llvm-a6438ca12a72efe147e74b6ea4698f696f52b969.tar.gz llvm-a6438ca12a72efe147e74b6ea4698f696f52b969.tar.bz2 |
Fix PR#24267. use numeric_limits::max instead of ~0 for 'all ones', since that might give wrong answers on a 1's complement machine.
llvm-svn: 243674
Diffstat (limited to 'libcxx/include/algorithm')
-rw-r--r-- | libcxx/include/algorithm | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/libcxx/include/algorithm b/libcxx/include/algorithm index 7b0c53e..c1635fc 100644 --- a/libcxx/include/algorithm +++ b/libcxx/include/algorithm @@ -3037,7 +3037,7 @@ uniform_int_distribution<_IntType>::operator()(_URNG& __g, const param_type& __p if (_Rp == 0) return static_cast<result_type>(_Eng(__g, _Dt)()); size_t __w = _Dt - __clz(_Rp) - 1; - if ((_Rp & (_UIntType(~0) >> (_Dt - __w))) != 0) + if ((_Rp & (std::numeric_limits<_UIntType>::max() >> (_Dt - __w))) != 0) ++__w; _Eng __e(__g, __w); _UIntType __u; |