Update <random> with constexpr support. Patch contributed by Jonathan Sauer.
llvm-svn: 153896
Cr-Mirrored-From: sso://chromium.googlesource.com/_direct/external/github.com/llvm/llvm-project
Cr-Mirrored-Commit: e386b7b360d6508f974db64d43d13129e36e2b22
diff --git a/include/algorithm b/include/algorithm
index 68e989a..d924a7d 100644
--- a/include/algorithm
+++ b/include/algorithm
@@ -2508,11 +2508,16 @@
_Engine_result_type __mask0_;
_Engine_result_type __mask1_;
+#ifdef _LIBCPP_HAS_NO_CONSTEXPR
static const _Working_result_type _Rp = _Engine::_Max - _Engine::_Min
- + _Working_result_type(1);
- static const size_t __m = __log2<_Working_result_type, _Rp>::value;
- static const size_t _WDt = numeric_limits<_Working_result_type>::digits;
- static const size_t _EDt = numeric_limits<_Engine_result_type>::digits;
+ + _Working_result_type(1);
+#else
+ static _LIBCPP_CONSTEXPR const _Working_result_type _Rp = _Engine::max() - _Engine::min()
+ + _Working_result_type(1);
+#endif
+ static _LIBCPP_CONSTEXPR const size_t __m = __log2<_Working_result_type, _Rp>::value;
+ static _LIBCPP_CONSTEXPR const size_t _WDt = numeric_limits<_Working_result_type>::digits;
+ static _LIBCPP_CONSTEXPR const size_t _EDt = numeric_limits<_Engine_result_type>::digits;
public:
// constructors and seeding functions