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

Unified Diff: third_party/WebKit/Source/platform/wtf/dtoa/strtod.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
« no previous file with comments | « third_party/WebKit/Source/platform/wtf/dtoa/fixed-dtoa.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/platform/wtf/dtoa/strtod.cc
diff --git a/third_party/WebKit/Source/platform/wtf/dtoa/strtod.cc b/third_party/WebKit/Source/platform/wtf/dtoa/strtod.cc
index 6a841c4389b4f8085b08879624dbf6640689ca94..3746aa78158da1fec8e52dd7080fd7f2a242bc26 100644
--- a/third_party/WebKit/Source/platform/wtf/dtoa/strtod.cc
+++ b/third_party/WebKit/Source/platform/wtf/dtoa/strtod.cc
@@ -119,7 +119,7 @@ namespace double_conversion {
}
// The input buffer has been trimmed. Therefore the last digit must be
// different from '0'.
- ASSERT(buffer[buffer.length() - 1] != '0');
+ DCHECK_NE(buffer[buffer.length() - 1], '0');
// Set the last digit to be non-zero. This is sufficient to guarantee
// correct rounding.
significant_buffer[kMaxSignificantDecimalDigits - 1] = '1';
@@ -138,7 +138,8 @@ namespace double_conversion {
int i = 0;
while (i < buffer.length() && result <= (kMaxUint64 / 10 - 1)) {
int digit = buffer[i++] - '0';
- ASSERT(0 <= digit && digit <= 9);
+ DCHECK_LE(0, digit);
+ DCHECK_LE(digit, 9);
result = 10 * result + digit;
}
*number_of_read_digits = i;
@@ -194,14 +195,14 @@ namespace double_conversion {
if (exponent < 0 && -exponent < kExactPowersOfTenSize) {
// 10^-exponent fits into a double.
*result = static_cast<double>(ReadUint64(trimmed, &read_digits));
- ASSERT(read_digits == trimmed.length());
+ DCHECK_EQ(read_digits, trimmed.length());
*result /= exact_powers_of_ten[-exponent];
return true;
}
if (0 <= exponent && exponent < kExactPowersOfTenSize) {
// 10^exponent fits into a double.
*result = static_cast<double>(ReadUint64(trimmed, &read_digits));
- ASSERT(read_digits == trimmed.length());
+ DCHECK_EQ(read_digits, trimmed.length());
*result *= exact_powers_of_ten[exponent];
return true;
}
@@ -213,7 +214,7 @@ namespace double_conversion {
// 10^remaining_digits. As a result the remaining exponent now fits
// into a double too.
*result = static_cast<double>(ReadUint64(trimmed, &read_digits));
- ASSERT(read_digits == trimmed.length());
+ DCHECK_EQ(read_digits, trimmed.length());
*result *= exact_powers_of_ten[remaining_digits];
*result *= exact_powers_of_ten[exponent - remaining_digits];
return true;
@@ -226,11 +227,11 @@ namespace double_conversion {
// Returns 10^exponent as an exact DiyFp.
// The given exponent must be in the range [1; kDecimalExponentDistance[.
static DiyFp AdjustmentPowerOfTen(int exponent) {
- ASSERT(0 < exponent);
- ASSERT(exponent < PowersOfTenCache::kDecimalExponentDistance);
+ DCHECK_LT(0, exponent);
+ DCHECK_LT(exponent, PowersOfTenCache::kDecimalExponentDistance);
// Simply hardcode the remaining powers for the given decimal exponent
// distance.
- ASSERT(PowersOfTenCache::kDecimalExponentDistance == 8);
+ DCHECK_EQ(PowersOfTenCache::kDecimalExponentDistance, 8);
switch (exponent) {
case 1: return DiyFp(UINT64_2PART_C(0xa0000000, 00000000), -60);
case 2: return DiyFp(UINT64_2PART_C(0xc8000000, 00000000), -57);
@@ -270,7 +271,7 @@ namespace double_conversion {
input.Normalize();
error <<= old_e - input.E();
- ASSERT(exponent <= PowersOfTenCache::kMaxDecimalExponent);
+ DCHECK_LE(exponent, PowersOfTenCache::kMaxDecimalExponent);
if (exponent < PowersOfTenCache::kMinDecimalExponent) {
*result = 0.0;
return true;
@@ -288,7 +289,7 @@ namespace double_conversion {
if (kMaxUint64DecimalDigits - buffer.length() >= adjustment_exponent) {
// The product of input with the adjustment power fits into a 64 bit
// integer.
- ASSERT(DiyFp::kSignificandSize == 64);
+ DCHECK_EQ(DiyFp::kSignificandSize, 64);
} else {
// The adjustment power is exact. There is hence only an error of 0.5.
error += kDenominator / 2;
@@ -330,8 +331,8 @@ namespace double_conversion {
precision_digits_count -= shift_amount;
}
// We use uint64_ts now. This only works if the DiyFp uses uint64_ts too.
- ASSERT(DiyFp::kSignificandSize == 64);
- ASSERT(precision_digits_count < 64);
+ DCHECK_EQ(DiyFp::kSignificandSize, 64);
+ DCHECK_LT(precision_digits_count, 64);
uint64_t one64 = 1;
uint64_t precision_bits_mask = (one64 << precision_digits_count) - 1;
uint64_t precision_bits = input.F() & precision_bits_mask;
@@ -375,14 +376,14 @@ namespace double_conversion {
DiyFp upper_boundary = Double(guess).UpperBoundary();
- ASSERT(buffer.length() + exponent <= kMaxDecimalPower + 1);
- ASSERT(buffer.length() + exponent > kMinDecimalPower);
- ASSERT(buffer.length() <= kMaxSignificantDecimalDigits);
+ DCHECK_LE(buffer.length() + exponent, kMaxDecimalPower + 1);
+ DCHECK_GT(buffer.length() + exponent, kMinDecimalPower);
+ DCHECK_LE(buffer.length(), kMaxSignificantDecimalDigits);
// Make sure that the Bignum will be able to hold all our numbers.
// Our Bignum implementation has a separate field for exponents. Shifts will
// consume at most one bigit (< 64 bits).
// ln(10) == 3.3219...
- ASSERT(((kMaxDecimalPower + 1) * 333 / 100) < Bignum::kMaxSignificantBits);
+ DCHECK_LT(((kMaxDecimalPower + 1) * 333 / 100), Bignum::kMaxSignificantBits);
Bignum input;
Bignum boundary;
input.AssignDecimalString(buffer);
« no previous file with comments | « third_party/WebKit/Source/platform/wtf/dtoa/fixed-dtoa.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698