[libcxx-commits] [libcxx] r369393 - [libc++] Explicitly cast in generate_canonical

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Tue Aug 20 08:39:21 PDT 2019


Author: ldionne
Date: Tue Aug 20 08:39:20 2019
New Revision: 369393

URL: http://llvm.org/viewvc/llvm-project?rev=369393&view=rev
Log:
[libc++] Explicitly cast in generate_canonical

A new clang warning introduced in r367497 was complaining about
the change in value.

Thanks to Brian Cain for the patch.
Differential Revision: https://reviews.llvm.org/D66422

Modified:
    libcxx/trunk/include/random

Modified: libcxx/trunk/include/random
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/random?rev=369393&r1=369392&r2=369393&view=diff
==============================================================================
--- libcxx/trunk/include/random (original)
+++ libcxx/trunk/include/random Tue Aug 20 08:39:20 2019
@@ -3645,7 +3645,7 @@ generate_canonical(_URNG& __g)
     const size_t __logR = __log2<uint64_t, _URNG::max() - _URNG::min() + uint64_t(1)>::value;
 #endif
     const size_t __k = __b / __logR + (__b % __logR != 0) + (__b == 0);
-    const _RealType _Rp = _URNG::max() - _URNG::min() + _RealType(1);
+    const _RealType _Rp = static_cast<_RealType>(_URNG::max() - _URNG::min()) + _RealType(1);
     _RealType __base = _Rp;
     _RealType _Sp = __g() - _URNG::min();
     for (size_t __i = 1; __i < __k; ++__i, __base *= _Rp)




More information about the libcxx-commits mailing list