[libcxx-commits] [PATCH] D66422: [libcxx] Explicitly cast in generate_canonical

Brian Cain via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Mon Aug 19 09:00:27 PDT 2019


bcain created this revision.
bcain added reviewers: ldionne, mclow.lists.
Herald added a reviewer: EricWF.
Herald added subscribers: dexonsmith, christof.

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


Repository:
  rCXX libc++

https://reviews.llvm.org/D66422

Files:
  libcxx/include/random


Index: libcxx/include/random
===================================================================
--- libcxx/include/random
+++ libcxx/include/random
@@ -3645,7 +3645,8 @@
     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)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D66422.215919.patch
Type: text/x-patch
Size: 651 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20190819/ddd9d517/attachment.bin>


More information about the libcxx-commits mailing list