gecko-dev/mfbt/double-conversion/debug-only-functions.patch

40 строки
1.2 KiB
Diff

diff --git a/mfbt/double-conversion/double-conversion/strtod.cc b/mfbt/double-conversion/double-conversion/strtod.cc
index 850bcdaac4ad1..6ed686c8d9bfb 100644
--- a/mfbt/double-conversion/double-conversion/strtod.cc
+++ b/mfbt/double-conversion/double-conversion/strtod.cc
@@ -447,32 +447,34 @@ static bool ComputeGuess(Vector<const char> trimmed, int exponent,
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');
}
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;