blob: 3988eaad56c5ba4c15bec913e0e23314db3d25b2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
diff --git a/mfbt/double-conversion/double-conversion/strtod.cc b/mfbt/double-conversion/double-conversion/strtod.cc
--- a/mfbt/double-conversion/double-conversion/strtod.cc
+++ b/mfbt/double-conversion/double-conversion/strtod.cc
@@ -436,16 +436,17 @@ static bool ComputeGuess(Vector<const ch
return true;
}
if (*guess == Double::Infinity()) {
return true;
}
return false;
}
+#ifdef DEBUG
static bool IsDigit(const char d) {
return ('0' <= d) && (d <= '9');
}
static bool IsNonZeroDigit(const char d) {
return ('1' <= d) && (d <= '9');
}
@@ -457,16 +458,17 @@ static bool IsNonZeroDigit(const char d)
static bool AssertTrimmedDigits(const Vector<const char>& buffer) {
for(int i = 0; i < buffer.length(); ++i) {
if(!IsDigit(buffer[i])) {
return false;
}
}
return (buffer.length() == 0) || (IsNonZeroDigit(buffer[0]) && IsNonZeroDigit(buffer[buffer.length()-1]));
}
+#endif
double StrtodTrimmed(Vector<const char> trimmed, int exponent) {
DOUBLE_CONVERSION_ASSERT(trimmed.length() <= kMaxSignificantDecimalDigits);
DOUBLE_CONVERSION_ASSERT(AssertTrimmedDigits(trimmed));
double guess;
const bool is_correct = ComputeGuess(trimmed, exponent, &guess);
if (is_correct) {
return guess;
|