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

Unified Diff: third_party/WebKit/Source/platform/wtf/dtoa/bignum-dtoa.cc

Issue 2839663003: Replace ASSERT with DHCECK_op in platform/wtf (Closed)
Patch Set: fix indentation Created 3 years, 7 months 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
Index: third_party/WebKit/Source/platform/wtf/dtoa/bignum-dtoa.cc
diff --git a/third_party/WebKit/Source/platform/wtf/dtoa/bignum-dtoa.cc b/third_party/WebKit/Source/platform/wtf/dtoa/bignum-dtoa.cc
index bee7cf3c52b8647ea713ef757370164b42a6608b..4c377d0bb912260dbe390ac4bd9439464d11fd86 100644
--- a/third_party/WebKit/Source/platform/wtf/dtoa/bignum-dtoa.cc
+++ b/third_party/WebKit/Source/platform/wtf/dtoa/bignum-dtoa.cc
@@ -36,7 +36,7 @@ namespace WTF {
namespace double_conversion {
static int NormalizedExponent(uint64_t significand, int exponent) {
- ASSERT(significand != 0);
+ DCHECK_NE(significand, 0u);
while ((significand & Double::kHiddenBit) == 0) {
significand = significand << 1;
exponent = exponent - 1;
@@ -87,7 +87,7 @@ namespace double_conversion {
void BignumDtoa(double v, BignumDtoaMode mode, int requested_digits,
Vector<char> buffer, int* length, int* decimal_point) {
- ASSERT(v > 0);
+ DCHECK_GT(v, 0);
DCHECK(!Double(v).IsSpecial());
uint64_t significand = Double(v).Significand();
bool is_even = (significand & 1) == 0;
@@ -118,7 +118,7 @@ namespace double_conversion {
// 4e-324. In this case the denominator needs fewer than 324*4 binary digits.
// The maximum double is 1.7976931348623157e308 which needs fewer than
// 308*4 binary digits.
- ASSERT(Bignum::kMaxSignificantBits >= 324*4);
+ DCHECK_GE(Bignum::kMaxSignificantBits, 324*4);
bool need_boundary_deltas = (mode == BIGNUM_DTOA_SHORTEST);
InitialScaledStartValues(v, estimated_power, need_boundary_deltas,
&numerator, &denominator,
@@ -178,7 +178,7 @@ namespace double_conversion {
while (true) {
uint16_t digit;
digit = numerator->DivideModuloIntBignum(*denominator);
- ASSERT(digit <= 9); // digit is a uint16_t and therefore always positive.
+ DCHECK_LE(digit, 9u); // digit is a uint16_t and therefore always positive.
// digit = numerator / denominator (integer division).
// numerator = numerator % denominator.
buffer[(*length)++] = static_cast<char>(digit + '0');
@@ -224,7 +224,7 @@ namespace double_conversion {
// loop would have stopped earlier.
// We still have an assert here in case the preconditions were not
// satisfied.
- ASSERT(buffer[(*length) - 1] != '9');
+ DCHECK_NE(buffer[(*length) - 1], '9');
buffer[(*length) - 1]++;
} else {
// Halfway case.
@@ -235,7 +235,7 @@ namespace double_conversion {
if ((buffer[(*length) - 1] - '0') % 2 == 0) {
// Round down => Do nothing.
} else {
- ASSERT(buffer[(*length) - 1] != '9');
+ DCHECK_NE(buffer[(*length) - 1], '9');
buffer[(*length) - 1]++;
}
}
@@ -249,7 +249,7 @@ namespace double_conversion {
// stopped the loop earlier.
// We still have an ASSERT here, in case the preconditions were not
// satisfied.
- ASSERT(buffer[(*length) -1] != '9');
+ DCHECK_NE(buffer[(*length) -1], '9');
buffer[(*length) - 1]++;
return;
}
@@ -266,11 +266,11 @@ namespace double_conversion {
static void GenerateCountedDigits(int count, int* decimal_point,
Bignum* numerator, Bignum* denominator,
Vector<char>(buffer), int* length) {
- ASSERT(count >= 0);
+ DCHECK_GE(count, 0);
for (int i = 0; i < count - 1; ++i) {
uint16_t digit;
digit = numerator->DivideModuloIntBignum(*denominator);
- ASSERT(digit <= 9); // digit is a uint16_t and therefore always positive.
+ DCHECK_LE(digit, 9u); // digit is a uint16_t and therefore always positive.
// digit = numerator / denominator (integer division).
// numerator = numerator % denominator.
buffer[i] = static_cast<char>(digit + '0');
@@ -323,7 +323,7 @@ namespace double_conversion {
} else if (-(*decimal_point) == requested_digits) {
// We only need to verify if the number rounds down or up.
// Ex: 0.04 and 0.06 with requested_digits == 1.
- ASSERT(*decimal_point == -requested_digits);
+ DCHECK_EQ(*decimal_point, -requested_digits);
// Initially the fraction lies in range (1, 10]. Multiply the denominator
// by 10 so that we can compare more easily.
denominator->Times10();
@@ -402,7 +402,7 @@ namespace double_conversion {
Bignum* numerator, Bignum* denominator,
Bignum* delta_minus, Bignum* delta_plus) {
// A positive exponent implies a positive power.
- ASSERT(estimated_power >= 0);
+ DCHECK_GE(estimated_power, 0);
// Since the estimated_power is positive we simply multiply the denominator
// by 10^estimated_power.
@@ -521,7 +521,7 @@ namespace double_conversion {
// numerator = v * 10^-estimated_power * 2 * 2^-exponent.
// Remember: numerator has been abused as power_ten. So no need to assign it
// to itself.
- ASSERT(numerator == power_ten);
+ DCHECK_EQ(numerator, power_ten);
numerator->MultiplyByUInt64(significand);
// denominator = 2 * 2^-exponent with exponent < 0.
« no previous file with comments | « third_party/WebKit/Source/platform/wtf/dtoa/bignum.cc ('k') | third_party/WebKit/Source/platform/wtf/dtoa/cached-powers.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698