Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4064)

Unified Diff: base/rand_util.cc

Issue 1467003002: Switch to static_assert in base/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: / Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/observer_list_threadsafe.h ('k') | base/strings/safe_sprintf.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/rand_util.cc
diff --git a/base/rand_util.cc b/base/rand_util.cc
index e12088e54344a9f0ba2de21d45a0cd467bd016df..1a3b79e5104d1fd74f7359c068617b8ef2691df2 100644
--- a/base/rand_util.cc
+++ b/base/rand_util.cc
@@ -38,7 +38,8 @@ double BitsToOpenEndedUnitInterval(uint64_t bits) {
// produce output in the range [0, 1). For IEEE 754 doubles, the mantissa
// is expected to accommodate 53 bits.
- COMPILE_ASSERT(std::numeric_limits<double>::radix == 2, otherwise_use_scalbn);
+ static_assert(std::numeric_limits<double>::radix == 2,
+ "otherwise use scalbn");
static const int kBits = std::numeric_limits<double>::digits;
uint64_t random_bits = bits & ((UINT64_C(1) << kBits) - 1);
double result = ldexp(static_cast<double>(random_bits), -1 * kBits);
« no previous file with comments | « base/observer_list_threadsafe.h ('k') | base/strings/safe_sprintf.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698