Bug 1402344 - Update mfbt-double-conversion to the latest upstream rev. r=froydnj

--HG--
rename : mfbt/double-conversion/source/LICENSE => mfbt/double-conversion/double-conversion/LICENSE
rename : mfbt/double-conversion/source/README.md => mfbt/double-conversion/double-conversion/README.md
rename : mfbt/double-conversion/source/bignum-dtoa.cc => mfbt/double-conversion/double-conversion/bignum-dtoa.cc
rename : mfbt/double-conversion/source/bignum-dtoa.h => mfbt/double-conversion/double-conversion/bignum-dtoa.h
rename : mfbt/double-conversion/source/bignum.cc => mfbt/double-conversion/double-conversion/bignum.cc
rename : mfbt/double-conversion/source/bignum.h => mfbt/double-conversion/double-conversion/bignum.h
rename : mfbt/double-conversion/source/cached-powers.cc => mfbt/double-conversion/double-conversion/cached-powers.cc
rename : mfbt/double-conversion/source/cached-powers.h => mfbt/double-conversion/double-conversion/cached-powers.h
rename : mfbt/double-conversion/source/diy-fp.cc => mfbt/double-conversion/double-conversion/diy-fp.cc
rename : mfbt/double-conversion/source/diy-fp.h => mfbt/double-conversion/double-conversion/diy-fp.h
rename : mfbt/double-conversion/source/double-conversion.cc => mfbt/double-conversion/double-conversion/double-conversion.cc
rename : mfbt/double-conversion/source/double-conversion.h => mfbt/double-conversion/double-conversion/double-conversion.h
rename : mfbt/double-conversion/source/fast-dtoa.cc => mfbt/double-conversion/double-conversion/fast-dtoa.cc
rename : mfbt/double-conversion/source/fast-dtoa.h => mfbt/double-conversion/double-conversion/fast-dtoa.h
rename : mfbt/double-conversion/source/fixed-dtoa.cc => mfbt/double-conversion/double-conversion/fixed-dtoa.cc
rename : mfbt/double-conversion/source/fixed-dtoa.h => mfbt/double-conversion/double-conversion/fixed-dtoa.h
rename : mfbt/double-conversion/source/ieee.h => mfbt/double-conversion/double-conversion/ieee.h
rename : mfbt/double-conversion/source/strtod.cc => mfbt/double-conversion/double-conversion/strtod.cc
rename : mfbt/double-conversion/source/strtod.h => mfbt/double-conversion/double-conversion/strtod.h
rename : mfbt/double-conversion/source/utils.h => mfbt/double-conversion/double-conversion/utils.h
extra : rebase_source : 2d03850dcd1db749f0debecffec2e870acd1b958
This commit is contained in:
Jeff Walden 2017-10-09 22:15:37 -07:00
Родитель d90b841ba7
Коммит be56429c85
32 изменённых файлов: 290 добавлений и 121 удалений

Просмотреть файл

@ -11,7 +11,7 @@
#include "mozilla/RefPtr.h"
#include "mozilla/RefCounted.h"
#include "mozilla/UniquePtr.h"
#include "mozilla/utils.h"
#include "double-conversion/utils.h" // for DISALLOW_COPY_AND_ASSIGN
#include "CodecConfig.h"
#include "VideoTypes.h"
#include "MediaConduitErrors.h"

Просмотреть файл

@ -10,7 +10,7 @@
// of Decimal.cpp under the Mozilla source without blink core dependencies. Do
// not include it into any file other than Decimal.cpp.
#include "../double-conversion/source/double-conversion.h"
#include "../double-conversion/double-conversion/double-conversion.h"
#include "mozilla/ArrayUtils.h"
#include "mozilla/Casting.h"
#include "mozilla/FloatingPoint.h"

17
mfbt/double-conversion.h Normal file
Просмотреть файл

@ -0,0 +1,17 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/*
* A temporary header providing double-conversion functionality until we change
* our code to use the double-conversion header directly.
*/
#ifndef mozilla_double_conversion_h
#define mozilla_double_conversion_h
#include "double-conversion/double-conversion.h"
#endif /* mozilla_double_conversion_h */

Просмотреть файл

@ -1,9 +1,9 @@
commit d8d4e668ee1e6e10b728f0671a89b07d7c4d45be
Merge: 79fb300 48b5e70
Author: Florian Loitsch <florian@loitsch.com>
Date: Wed Nov 23 19:14:38 2016 +0100
commit fe9b384793c4e79bd32133dc9053f27b75a5eeae
Merge: 2a257b7 1d5a688
Author: Florian Loitsch <floitsch@google.com>
Date: Fri Sep 15 11:32:00 2017 +0200
Merge pull request #39 from uburuntu/master
Merge pull request #52 from uburuntu/master
Some small fixes: compilation, null ptr derefence and const qualifiers
Some refactorings: remove unused static, replace deprecated headers, init member in constructor

Просмотреть файл

@ -1,9 +1,12 @@
1e7bf0c636b8cca54dd83456a0f8fa219343e2a1 Bug 608195 - part 2 - extend ToPrecision to tell use whether exponential notation was used
diff --git a/mfbt/double-conversion/source/double-conversion.cc b/mfbt/double-conversion/source/double-conversion.cc
index febba6c..394b6a0 100644
--- a/mfbt/double-conversion/source/double-conversion.cc
+++ b/mfbt/double-conversion/source/double-conversion.cc
@@ -283,7 +283,9 @@ bool DoubleToStringConverter::ToExponential(
diff --git a/mfbt/double-conversion/double-conversion/double-conversion.cc b/mfbt/double-conversion/double-conversion/double-conversion.cc
--- a/mfbt/double-conversion/double-conversion/double-conversion.cc
+++ b/mfbt/double-conversion/double-conversion/double-conversion.cc
@@ -279,17 +279,19 @@ bool DoubleToStringConverter::ToExponent
exponent,
result_builder);
return true;
}
bool DoubleToStringConverter::ToPrecision(double value,
int precision,
@ -13,7 +16,17 @@ index febba6c..394b6a0 100644
if (Double(value).IsSpecial()) {
return HandleSpecialValues(value, result_builder);
}
@@ -325,6 +327,7 @@ bool DoubleToStringConverter::ToPrecision(double value,
if (precision < kMinPrecisionDigits || precision > kMaxPrecisionDigits) {
return false;
}
@@ -321,16 +323,17 @@ bool DoubleToStringConverter::ToPrecisio
max_trailing_padding_zeroes_in_precision_mode_)) {
// Fill buffer to contain 'precision' digits.
// Usually the buffer is already at the correct length, but 'DoubleToAscii'
// is allowed to return less characters.
for (int i = decimal_rep_length; i < precision; ++i) {
decimal_rep[i] = '0';
}
@ -21,11 +34,20 @@ index febba6c..394b6a0 100644
CreateExponentialRepresentation(decimal_rep,
precision,
exponent,
diff --git a/mfbt/double-conversion/source/double-conversion.h b/mfbt/double-conversion/source/double-conversion.h
index 0900ba0..957575c 100644
--- a/mfbt/double-conversion/source/double-conversion.h
+++ b/mfbt/double-conversion/source/double-conversion.h
@@ -270,6 +270,7 @@ class DoubleToStringConverter {
result_builder);
} else {
CreateDecimalRepresentation(decimal_rep, decimal_rep_length, decimal_point,
Max(0, precision - decimal_point),
result_builder);
diff --git a/mfbt/double-conversion/double-conversion/double-conversion.h b/mfbt/double-conversion/double-conversion/double-conversion.h
--- a/mfbt/double-conversion/double-conversion/double-conversion.h
+++ b/mfbt/double-conversion/double-conversion/double-conversion.h
@@ -265,16 +265,17 @@ class DoubleToStringConverter {
// been provided to the constructor,
// - precision < kMinPericisionDigits
// - precision > kMaxPrecisionDigits
// The last condition implies that the result will never contain more than
// kMaxPrecisionDigits + 7 characters (the sign, the decimal point, the
// exponent character, the exponent's sign, and at most 3 exponent digits).
MFBT_API bool ToPrecision(double value,
int precision,
@ -33,3 +55,8 @@ index 0900ba0..957575c 100644
StringBuilder* result_builder) const;
enum DtoaMode {
// Produce the shortest correct representation.
// For example the output of 0.299999999999999988897 is (the less accurate
// but correct) 0.3.
SHORTEST,
// Same as SHORTEST, but for single-precision floats.

Просмотреть файл

@ -1,16 +1,30 @@
diff --git a/mfbt/double-conversion/source/double-conversion.h b/mfbt/double-conversion/source/double-conversion.h
index f98edae..c62b16b 100644
--- a/mfbt/double-conversion/source/double-conversion.h
+++ b/mfbt/double-conversion/source/double-conversion.h
@@ -28,6 +28,7 @@
diff --git a/mfbt/double-conversion/double-conversion/double-conversion.h b/mfbt/double-conversion/double-conversion/double-conversion.h
--- a/mfbt/double-conversion/double-conversion/double-conversion.h
+++ b/mfbt/double-conversion/double-conversion/double-conversion.h
@@ -23,16 +23,17 @@
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef DOUBLE_CONVERSION_DOUBLE_CONVERSION_H_
#define DOUBLE_CONVERSION_DOUBLE_CONVERSION_H_
+#include "mozilla/Types.h"
#include "utils.h"
#include <double-conversion/utils.h>
namespace double_conversion {
@@ -129,7 +130,7 @@ class DoubleToStringConverter {
class DoubleToStringConverter {
public:
// When calling ToFixed with a double > 10^kMaxFixedDigitsBeforePoint
// or a requested_digits parameter > kMaxFixedDigitsAfterPoint then the
@@ -124,17 +125,17 @@ class DoubleToStringConverter {
max_trailing_padding_zeroes_in_precision_mode) {
// When 'trailing zero after the point' is set, then 'trailing point'
// must be set too.
ASSERT(((flags & EMIT_TRAILING_DECIMAL_POINT) != 0) ||
!((flags & EMIT_TRAILING_ZERO_AFTER_POINT) != 0));
}
// Returns a converter following the EcmaScript specification.
@ -19,7 +33,17 @@ index f98edae..c62b16b 100644
// Computes the shortest string of digits that correctly represent the input
// number. Depending on decimal_in_shortest_low and decimal_in_shortest_high
@@ -197,7 +198,7 @@ class DoubleToStringConverter {
// (see constructor) it then either returns a decimal representation, or an
// exponential representation.
// Example with decimal_in_shortest_low = -6,
// decimal_in_shortest_high = 21,
// EMIT_POSITIVE_EXPONENT_SIGN activated, and
@@ -192,17 +193,17 @@ class DoubleToStringConverter {
// except for the following cases:
// - the input value is special and no infinity_symbol or nan_symbol has
// been provided to the constructor,
// - 'value' > 10^kMaxFixedDigitsBeforePoint, or
// - 'requested_digits' > kMaxFixedDigitsAfterPoint.
// The last two conditions imply that the result will never contain more than
// 1 + kMaxFixedDigitsBeforePoint + 1 + kMaxFixedDigitsAfterPoint characters
// (one additional character for the sign, and one for the decimal point).
@ -28,7 +52,17 @@ index f98edae..c62b16b 100644
int requested_digits,
StringBuilder* result_builder) const;
@@ -229,7 +230,7 @@ class DoubleToStringConverter {
// Computes a representation in exponential format with requested_digits
// after the decimal point. The last emitted digit is rounded.
// If requested_digits equals -1, then the shortest exponential representation
// is computed.
//
@@ -224,17 +225,17 @@ class DoubleToStringConverter {
// except for the following cases:
// - the input value is special and no infinity_symbol or nan_symbol has
// been provided to the constructor,
// - 'requested_digits' > kMaxExponentialDigits.
// The last condition implies that the result will never contain more than
// kMaxExponentialDigits + 8 characters (the sign, the digit before the
// decimal point, the decimal point, the exponent character, the
// exponent's sign, and at most 3 exponent digits).
@ -37,7 +71,17 @@ index f98edae..c62b16b 100644
int requested_digits,
StringBuilder* result_builder) const;
@@ -267,7 +268,7 @@ class DoubleToStringConverter {
// Computes 'precision' leading digits of the given 'value' and returns them
// either in exponential or decimal format, depending on
// max_{leading|trailing}_padding_zeroes_in_precision_mode (given to the
// constructor).
// The last computed digit is rounded.
@@ -262,17 +263,17 @@ class DoubleToStringConverter {
// except for the following cases:
// - the input value is special and no infinity_symbol or nan_symbol has
// been provided to the constructor,
// - precision < kMinPericisionDigits
// - precision > kMaxPrecisionDigits
// The last condition implies that the result will never contain more than
// kMaxPrecisionDigits + 7 characters (the sign, the decimal point, the
// exponent character, the exponent's sign, and at most 3 exponent digits).
@ -46,7 +90,17 @@ index f98edae..c62b16b 100644
int precision,
StringBuilder* result_builder) const;
@@ -292,7 +293,7 @@ class DoubleToStringConverter {
enum DtoaMode {
// Produce the shortest correct representation.
// For example the output of 0.299999999999999988897 is (the less accurate
// but correct) 0.3.
SHORTEST,
@@ -287,17 +288,17 @@ class DoubleToStringConverter {
};
// The maximal number of digits that are needed to emit a double in base 10.
// A higher precision can be achieved by using more digits, but the shortest
// accurate representation of any double will never use more digits than
// kBase10MaximalLength.
// Note that DoubleToAscii null-terminates its input. So the given buffer
// should be at least kBase10MaximalLength + 1 characters long.
@ -55,7 +109,17 @@ index f98edae..c62b16b 100644
// Converts the given double 'v' to ascii. 'v' must not be NaN, +Infinity, or
// -Infinity. In SHORTEST_SINGLE-mode this restriction also applies to 'v'
@@ -332,7 +333,7 @@ class DoubleToStringConverter {
// after it has been casted to a single-precision float. That is, in this
// mode static_cast<float>(v) must not be NaN, +Infinity or -Infinity.
//
// The result should be interpreted as buffer * 10^(point-length).
//
@@ -327,44 +328,44 @@ class DoubleToStringConverter {
// DoubleToAscii expects the given buffer to be big enough to hold all
// digits and a terminating null-character. In SHORTEST-mode it expects a
// buffer of at least kBase10MaximalLength + 1. In all other modes the
// requested_digits parameter and the padding-zeroes limit the size of the
// output. Don't forget the decimal point, the exponent character and the
// terminating null-character when computing the maximal output size.
// The given length is only used in debug mode to ensure the buffer is big
// enough.
@ -64,7 +128,10 @@ index f98edae..c62b16b 100644
DtoaMode mode,
int requested_digits,
char* buffer,
@@ -343,7 +344,7 @@ class DoubleToStringConverter {
int buffer_length,
bool* sign,
int* length,
int* point);
private:
// Implementation for ToShortest and ToShortestSingle.
@ -73,7 +140,7 @@ index f98edae..c62b16b 100644
StringBuilder* result_builder,
DtoaMode mode) const;
@@ -351,15 +352,15 @@ class DoubleToStringConverter {
// If the value is a special value (NaN or Infinity) constructs the
// corresponding string using the configured infinity/nan-symbol.
// If either of them is NULL or the value is not special then the
// function returns false.
@ -92,3 +159,8 @@ index f98edae..c62b16b 100644
int length,
int decimal_point,
int digits_after_point,
StringBuilder* result_builder) const;
const int flags_;
const char* const infinity_symbol_;
const char* const nan_symbol_;

Просмотреть файл

@ -25,12 +25,12 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <math.h>
#include <cmath>
#include "bignum-dtoa.h"
#include <double-conversion/bignum-dtoa.h>
#include "bignum.h"
#include "ieee.h"
#include <double-conversion/bignum.h>
#include <double-conversion/ieee.h>
namespace double_conversion {

Просмотреть файл

@ -28,7 +28,7 @@
#ifndef DOUBLE_CONVERSION_BIGNUM_DTOA_H_
#define DOUBLE_CONVERSION_BIGNUM_DTOA_H_
#include "utils.h"
#include <double-conversion/utils.h>
namespace double_conversion {

Просмотреть файл

@ -25,13 +25,13 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "bignum.h"
#include "utils.h"
#include <double-conversion/bignum.h>
#include <double-conversion/utils.h>
namespace double_conversion {
Bignum::Bignum()
: bigits_(bigits_buffer_, kBigitCapacity), used_digits_(0), exponent_(0) {
: bigits_buffer_(), bigits_(bigits_buffer_, kBigitCapacity), used_digits_(0), exponent_(0) {
for (int i = 0; i < kBigitCapacity; ++i) {
bigits_[i] = 0;
}
@ -445,26 +445,27 @@ void Bignum::AssignPowerUInt16(uint16_t base, int power_exponent) {
mask >>= 2;
uint64_t this_value = base;
bool delayed_multipliciation = false;
bool delayed_multiplication = false;
const uint64_t max_32bits = 0xFFFFFFFF;
while (mask != 0 && this_value <= max_32bits) {
this_value = this_value * this_value;
// Verify that there is enough space in this_value to perform the
// multiplication. The first bit_size bits must be 0.
if ((power_exponent & mask) != 0) {
ASSERT(bit_size > 0);
uint64_t base_bits_mask =
~((static_cast<uint64_t>(1) << (64 - bit_size)) - 1);
bool high_bits_zero = (this_value & base_bits_mask) == 0;
if (high_bits_zero) {
this_value *= base;
} else {
delayed_multipliciation = true;
delayed_multiplication = true;
}
}
mask >>= 1;
}
AssignUInt64(this_value);
if (delayed_multipliciation) {
if (delayed_multiplication) {
MultiplyByUInt32(base);
}

Просмотреть файл

@ -28,7 +28,7 @@
#ifndef DOUBLE_CONVERSION_BIGNUM_H_
#define DOUBLE_CONVERSION_BIGNUM_H_
#include "utils.h"
#include <double-conversion/utils.h>
namespace double_conversion {

Просмотреть файл

@ -25,13 +25,13 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <stdarg.h>
#include <limits.h>
#include <math.h>
#include <climits>
#include <cmath>
#include <cstdarg>
#include "utils.h"
#include <double-conversion/utils.h>
#include "cached-powers.h"
#include <double-conversion/cached-powers.h>
namespace double_conversion {

Просмотреть файл

@ -28,7 +28,7 @@
#ifndef DOUBLE_CONVERSION_CACHED_POWERS_H_
#define DOUBLE_CONVERSION_CACHED_POWERS_H_
#include "diy-fp.h"
#include <double-conversion/diy-fp.h>
namespace double_conversion {

Просмотреть файл

@ -26,8 +26,8 @@
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "diy-fp.h"
#include "utils.h"
#include <double-conversion/diy-fp.h>
#include <double-conversion/utils.h>
namespace double_conversion {

Просмотреть файл

@ -28,7 +28,7 @@
#ifndef DOUBLE_CONVERSION_DIY_FP_H_
#define DOUBLE_CONVERSION_DIY_FP_H_
#include "utils.h"
#include <double-conversion/utils.h>
namespace double_conversion {

Просмотреть файл

@ -25,17 +25,18 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <limits.h>
#include <math.h>
#include <climits>
#include <locale>
#include <cmath>
#include "double-conversion.h"
#include <double-conversion/double-conversion.h>
#include "bignum-dtoa.h"
#include "fast-dtoa.h"
#include "fixed-dtoa.h"
#include "ieee.h"
#include "strtod.h"
#include "utils.h"
#include <double-conversion/bignum-dtoa.h>
#include <double-conversion/fast-dtoa.h>
#include <double-conversion/fixed-dtoa.h>
#include <double-conversion/ieee.h>
#include <double-conversion/strtod.h>
#include <double-conversion/utils.h>
namespace double_conversion {
@ -417,21 +418,55 @@ void DoubleToStringConverter::DoubleToAscii(double v,
}
// Consumes the given substring from the iterator.
// Returns false, if the substring does not match.
template <class Iterator>
static bool ConsumeSubString(Iterator* current,
Iterator end,
const char* substring) {
ASSERT(**current == *substring);
namespace {
inline char ToLower(char ch) {
static const std::ctype<char>& cType =
std::use_facet<std::ctype<char> >(std::locale::classic());
return cType.tolower(ch);
}
inline char Pass(char ch) {
return ch;
}
template <class Iterator, class Converter>
static inline bool ConsumeSubStringImpl(Iterator* current,
Iterator end,
const char* substring,
Converter converter) {
ASSERT(converter(**current) == *substring);
for (substring++; *substring != '\0'; substring++) {
++*current;
if (*current == end || **current != *substring) return false;
if (*current == end || converter(**current) != *substring) {
return false;
}
}
++*current;
return true;
}
// Consumes the given substring from the iterator.
// Returns false, if the substring does not match.
template <class Iterator>
static bool ConsumeSubString(Iterator* current,
Iterator end,
const char* substring,
bool allow_case_insensibility) {
if (allow_case_insensibility) {
return ConsumeSubStringImpl(current, end, substring, ToLower);
} else {
return ConsumeSubStringImpl(current, end, substring, Pass);
}
}
// Consumes first character of the str is equal to ch
inline bool ConsumeFirstCharacter(char ch,
const char* str,
bool case_insensibility) {
return case_insensibility ? ToLower(ch) == str[0] : ch == str[0];
}
} // namespace
// Maximum number of significant digits in decimal representation.
// The longest possible double in decimal representation is
@ -632,7 +667,6 @@ static double RadixStringToIeee(Iterator* current,
return Double(DiyFp(number, exponent)).value();
}
template <class Iterator>
double StringToDoubleConverter::StringToIeee(
Iterator input,
@ -648,6 +682,8 @@ double StringToDoubleConverter::StringToIeee(
const bool allow_leading_spaces = (flags_ & ALLOW_LEADING_SPACES) != 0;
const bool allow_trailing_spaces = (flags_ & ALLOW_TRAILING_SPACES) != 0;
const bool allow_spaces_after_sign = (flags_ & ALLOW_SPACES_AFTER_SIGN) != 0;
const bool allow_case_insensibility = (flags_ & ALLOW_CASE_INSENSIBILITY) != 0;
// To make sure that iterator dereferencing is valid the following
// convention is used:
@ -697,8 +733,8 @@ double StringToDoubleConverter::StringToIeee(
}
if (infinity_symbol_ != NULL) {
if (*current == infinity_symbol_[0]) {
if (!ConsumeSubString(&current, end, infinity_symbol_)) {
if (ConsumeFirstCharacter(*current, infinity_symbol_, allow_case_insensibility)) {
if (!ConsumeSubString(&current, end, infinity_symbol_, allow_case_insensibility)) {
return junk_string_value_;
}
@ -716,8 +752,8 @@ double StringToDoubleConverter::StringToIeee(
}
if (nan_symbol_ != NULL) {
if (*current == nan_symbol_[0]) {
if (!ConsumeSubString(&current, end, nan_symbol_)) {
if (ConsumeFirstCharacter(*current, nan_symbol_, allow_case_insensibility)) {
if (!ConsumeSubString(&current, end, nan_symbol_, allow_case_insensibility)) {
return junk_string_value_;
}

Просмотреть файл

@ -29,7 +29,7 @@
#define DOUBLE_CONVERSION_DOUBLE_CONVERSION_H_
#include "mozilla/Types.h"
#include "utils.h"
#include <double-conversion/utils.h>
namespace double_conversion {
@ -391,7 +391,8 @@ class StringToDoubleConverter {
ALLOW_TRAILING_JUNK = 4,
ALLOW_LEADING_SPACES = 8,
ALLOW_TRAILING_SPACES = 16,
ALLOW_SPACES_AFTER_SIGN = 32
ALLOW_SPACES_AFTER_SIGN = 32,
ALLOW_CASE_INSENSIBILITY = 64,
};
// Flags should be a bit-or combination of the possible Flags-enum.
@ -423,6 +424,8 @@ class StringToDoubleConverter {
// - ALLOW_SPACES_AFTER_SIGN: ignore whitespace after the sign.
// Ex: StringToDouble("- 123.2") -> -123.2.
// StringToDouble("+ 123.2") -> 123.2
// - ALLOW_CASE_INSENSIBILITY: ignore case of characters for special values:
// infinity and nan.
//
// empty_string_value is returned when an empty string is given as input.
// If ALLOW_LEADING_SPACES or ALLOW_TRAILING_SPACES are set, then a string

Просмотреть файл

@ -25,11 +25,11 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "fast-dtoa.h"
#include <double-conversion/fast-dtoa.h>
#include "cached-powers.h"
#include "diy-fp.h"
#include "ieee.h"
#include <double-conversion/cached-powers.h>
#include <double-conversion/diy-fp.h>
#include <double-conversion/ieee.h>
namespace double_conversion {

Просмотреть файл

@ -28,7 +28,7 @@
#ifndef DOUBLE_CONVERSION_FAST_DTOA_H_
#define DOUBLE_CONVERSION_FAST_DTOA_H_
#include "utils.h"
#include <double-conversion/utils.h>
namespace double_conversion {

Просмотреть файл

@ -25,10 +25,10 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <math.h>
#include <cmath>
#include "fixed-dtoa.h"
#include "ieee.h"
#include <double-conversion/fixed-dtoa.h>
#include <double-conversion/ieee.h>
namespace double_conversion {
@ -259,7 +259,8 @@ static void FillFractionals(uint64_t fractionals, int exponent,
fractionals -= static_cast<uint64_t>(digit) << point;
}
// If the first bit after the point is set we have to round up.
if (((fractionals >> (point - 1)) & 1) == 1) {
ASSERT(fractionals == 0 || point - 1 >= 0);
if ((fractionals != 0) && ((fractionals >> (point - 1)) & 1) == 1) {
RoundUp(buffer, length, decimal_point);
}
} else { // We need 128 bits.

Просмотреть файл

@ -28,7 +28,7 @@
#ifndef DOUBLE_CONVERSION_FIXED_DTOA_H_
#define DOUBLE_CONVERSION_FIXED_DTOA_H_
#include "utils.h"
#include <double-conversion/utils.h>
namespace double_conversion {

Просмотреть файл

@ -28,7 +28,7 @@
#ifndef DOUBLE_CONVERSION_DOUBLE_H_
#define DOUBLE_CONVERSION_DOUBLE_H_
#include "diy-fp.h"
#include <double-conversion/diy-fp.h>
namespace double_conversion {

Просмотреть файл

@ -25,13 +25,13 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <stdarg.h>
#include <limits.h>
#include <climits>
#include <cstdarg>
#include "strtod.h"
#include "bignum.h"
#include "cached-powers.h"
#include "ieee.h"
#include <double-conversion/bignum.h>
#include <double-conversion/cached-powers.h>
#include <double-conversion/ieee.h>
#include <double-conversion/strtod.h>
namespace double_conversion {

Просмотреть файл

@ -28,7 +28,7 @@
#ifndef DOUBLE_CONVERSION_STRTOD_H_
#define DOUBLE_CONVERSION_STRTOD_H_
#include "utils.h"
#include <double-conversion/utils.h>
namespace double_conversion {

Просмотреть файл

@ -28,8 +28,8 @@
#ifndef DOUBLE_CONVERSION_UTILS_H_
#define DOUBLE_CONVERSION_UTILS_H_
#include <stdlib.h>
#include <string.h>
#include <cstdlib>
#include <cstring>
#include "mozilla/Assertions.h"
#ifndef ASSERT

Просмотреть файл

@ -16,7 +16,7 @@ LOCAL_PATCHES="$LOCAL_PATCHES use-mozilla-assertions.patch"
LOCAL_PATCHES="$LOCAL_PATCHES ToPrecision-exponential.patch"
TMPDIR=`mktemp --directory`
LOCAL_CLONE="$TMPDIR/double-conversion"
LOCAL_CLONE="$TMPDIR/new-double-conversion"
git clone https://github.com/google/double-conversion.git "$LOCAL_CLONE"
@ -26,8 +26,8 @@ if [ "$1" != "" ]; then
fi
# First clear out everything already present.
DEST=./source
mv "$DEST" "$TMPDIR"/
DEST=./double-conversion
mv "$DEST" "$TMPDIR"/old-double-conversion
mkdir "$DEST"
# Copy over critical files.

Просмотреть файл

@ -1,6 +1,6 @@
diff --git a/mfbt/double-conversion/source/utils.h b/mfbt/double-conversion/source/utils.h
--- a/mfbt/double-conversion/source/utils.h
+++ b/mfbt/double-conversion/source/utils.h
diff --git a/mfbt/double-conversion/double-conversion/utils.h b/mfbt/double-conversion/double-conversion/utils.h
--- a/mfbt/double-conversion/double-conversion/utils.h
+++ b/mfbt/double-conversion/double-conversion/utils.h
@@ -93,34 +93,18 @@ inline void abort_noreturn() { abort();
#endif

Просмотреть файл

@ -1,16 +1,16 @@
diff --git a/mfbt/double-conversion/source/utils.h b/mfbt/double-conversion/source/utils.h
--- a/mfbt/double-conversion/source/utils.h
+++ b/mfbt/double-conversion/source/utils.h
diff --git a/mfbt/double-conversion/double-conversion/utils.h b/mfbt/double-conversion/double-conversion/utils.h
--- a/mfbt/double-conversion/double-conversion/utils.h
+++ b/mfbt/double-conversion/double-conversion/utils.h
@@ -26,38 +26,38 @@
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef DOUBLE_CONVERSION_UTILS_H_
#define DOUBLE_CONVERSION_UTILS_H_
#include <stdlib.h>
#include <string.h>
#include <cstdlib>
#include <cstring>
-#include <assert.h>
-#include <cassert>
+#include "mozilla/Assertions.h"
#ifndef ASSERT
#define ASSERT(condition) \

Просмотреть файл

@ -34,8 +34,7 @@ EXPORTS.mozilla = [
'DebugOnly.h',
'decimal/Decimal.h',
'DefineEnum.h',
'double-conversion/source/double-conversion.h',
'double-conversion/source/utils.h',
'double-conversion.h',
'DoublyLinkedList.h',
'EndianUtils.h',
'EnumeratedArray.h',
@ -106,6 +105,15 @@ EXPORTS.mozilla = [
'XorShift128PlusRNG.h',
]
EXPORTS["double-conversion"] = [
'double-conversion/double-conversion/double-conversion.h',
'double-conversion/double-conversion/utils.h',
]
LOCAL_INCLUDES += [
'/mfbt/double-conversion',
]
if CONFIG['OS_ARCH'] == 'WINNT':
EXPORTS.mozilla += [
'WindowsVersion.h',

Просмотреть файл

@ -7,14 +7,14 @@
mfbt_src_lcppsrcs = [
'Assertions.cpp',
'ChaosMode.cpp',
'double-conversion/source/bignum-dtoa.cc',
'double-conversion/source/bignum.cc',
'double-conversion/source/cached-powers.cc',
'double-conversion/source/diy-fp.cc',
'double-conversion/source/double-conversion.cc',
'double-conversion/source/fast-dtoa.cc',
'double-conversion/source/fixed-dtoa.cc',
'double-conversion/source/strtod.cc',
'double-conversion/double-conversion/bignum-dtoa.cc',
'double-conversion/double-conversion/bignum.cc',
'double-conversion/double-conversion/cached-powers.cc',
'double-conversion/double-conversion/diy-fp.cc',
'double-conversion/double-conversion/double-conversion.cc',
'double-conversion/double-conversion/fast-dtoa.cc',
'double-conversion/double-conversion/fixed-dtoa.cc',
'double-conversion/double-conversion/strtod.cc',
'FloatingPoint.cpp',
'HashFunctions.cpp',
'JSONWriter.cpp',

Просмотреть файл

@ -6,6 +6,10 @@
Library('mfbt_staticruntime')
LOCAL_INCLUDES += [
'/mfbt/double-conversion',
]
include('../objs.mozbuild')
UNIFIED_SOURCES += mfbt_src_cppsrcs