double-conversion: update to 3.3.0
Retrieved from/changelog here: https://github.com/google/double-conversion/releases/tag/v3.3.0 Task-number: QTBUG-116236 Change-Id: Ifac887dfcb9151fe2bd8b7e3f5dfe763836a9adb Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> (cherry picked from commit 605412dd1996922ac1b05bfa43e47c8dc137d123) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
a31d82ba66
commit
afe0a6a4ab
@ -147,7 +147,7 @@ void Bignum::AssignHexString(Vector<const char> value) {
|
|||||||
}
|
}
|
||||||
if (tmp > 0) {
|
if (tmp > 0) {
|
||||||
DOUBLE_CONVERSION_ASSERT(tmp <= kBigitMask);
|
DOUBLE_CONVERSION_ASSERT(tmp <= kBigitMask);
|
||||||
RawBigit(used_bigits_++) = (tmp & kBigitMask);
|
RawBigit(used_bigits_++) = static_cast<Bignum::Chunk>(tmp & kBigitMask);
|
||||||
}
|
}
|
||||||
Clamp();
|
Clamp();
|
||||||
}
|
}
|
||||||
@ -204,7 +204,7 @@ void Bignum::AddBignum(const Bignum& other) {
|
|||||||
carry = sum >> kBigitSize;
|
carry = sum >> kBigitSize;
|
||||||
++bigit_pos;
|
++bigit_pos;
|
||||||
}
|
}
|
||||||
used_bigits_ = (std::max)(bigit_pos, static_cast<int>(used_bigits_));
|
used_bigits_ = static_cast<int16_t>(std::max(bigit_pos, static_cast<int>(used_bigits_)));
|
||||||
DOUBLE_CONVERSION_ASSERT(IsClamped());
|
DOUBLE_CONVERSION_ASSERT(IsClamped());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -240,7 +240,7 @@ void Bignum::ShiftLeft(const int shift_amount) {
|
|||||||
if (used_bigits_ == 0) {
|
if (used_bigits_ == 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
exponent_ += (shift_amount / kBigitSize);
|
exponent_ += static_cast<int16_t>(shift_amount / kBigitSize);
|
||||||
const int local_shift = shift_amount % kBigitSize;
|
const int local_shift = shift_amount % kBigitSize;
|
||||||
EnsureCapacity(used_bigits_ + 1);
|
EnsureCapacity(used_bigits_ + 1);
|
||||||
BigitsShiftLeft(local_shift);
|
BigitsShiftLeft(local_shift);
|
||||||
@ -418,7 +418,7 @@ void Bignum::Square() {
|
|||||||
DOUBLE_CONVERSION_ASSERT(accumulator == 0);
|
DOUBLE_CONVERSION_ASSERT(accumulator == 0);
|
||||||
|
|
||||||
// Don't forget to update the used_digits and the exponent.
|
// Don't forget to update the used_digits and the exponent.
|
||||||
used_bigits_ = product_length;
|
used_bigits_ = static_cast<int16_t>(product_length);
|
||||||
exponent_ *= 2;
|
exponent_ *= 2;
|
||||||
Clamp();
|
Clamp();
|
||||||
}
|
}
|
||||||
@ -739,8 +739,8 @@ void Bignum::Align(const Bignum& other) {
|
|||||||
for (int i = 0; i < zero_bigits; ++i) {
|
for (int i = 0; i < zero_bigits; ++i) {
|
||||||
RawBigit(i) = 0;
|
RawBigit(i) = 0;
|
||||||
}
|
}
|
||||||
used_bigits_ += zero_bigits;
|
used_bigits_ += static_cast<int16_t>(zero_bigits);
|
||||||
exponent_ -= zero_bigits;
|
exponent_ -= static_cast<int16_t>(zero_bigits);
|
||||||
|
|
||||||
DOUBLE_CONVERSION_ASSERT(used_bigits_ >= 0);
|
DOUBLE_CONVERSION_ASSERT(used_bigits_ >= 0);
|
||||||
DOUBLE_CONVERSION_ASSERT(exponent_ >= 0);
|
DOUBLE_CONVERSION_ASSERT(exponent_ >= 0);
|
||||||
|
@ -79,7 +79,14 @@ void DoubleToStringConverter::CreateExponentialRepresentation(
|
|||||||
StringBuilder* result_builder) const {
|
StringBuilder* result_builder) const {
|
||||||
DOUBLE_CONVERSION_ASSERT(length != 0);
|
DOUBLE_CONVERSION_ASSERT(length != 0);
|
||||||
result_builder->AddCharacter(decimal_digits[0]);
|
result_builder->AddCharacter(decimal_digits[0]);
|
||||||
if (length != 1) {
|
if (length == 1) {
|
||||||
|
if ((flags_ & EMIT_TRAILING_DECIMAL_POINT_IN_EXPONENTIAL) != 0) {
|
||||||
|
result_builder->AddCharacter('.');
|
||||||
|
if ((flags_ & EMIT_TRAILING_ZERO_AFTER_POINT_IN_EXPONENTIAL) != 0) {
|
||||||
|
result_builder->AddCharacter('0');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
result_builder->AddCharacter('.');
|
result_builder->AddCharacter('.');
|
||||||
result_builder->AddSubstring(&decimal_digits[1], length-1);
|
result_builder->AddSubstring(&decimal_digits[1], length-1);
|
||||||
}
|
}
|
||||||
|
@ -78,7 +78,9 @@ class DoubleToStringConverter {
|
|||||||
EMIT_TRAILING_DECIMAL_POINT = 2,
|
EMIT_TRAILING_DECIMAL_POINT = 2,
|
||||||
EMIT_TRAILING_ZERO_AFTER_POINT = 4,
|
EMIT_TRAILING_ZERO_AFTER_POINT = 4,
|
||||||
UNIQUE_ZERO = 8,
|
UNIQUE_ZERO = 8,
|
||||||
NO_TRAILING_ZERO = 16
|
NO_TRAILING_ZERO = 16,
|
||||||
|
EMIT_TRAILING_DECIMAL_POINT_IN_EXPONENTIAL = 32,
|
||||||
|
EMIT_TRAILING_ZERO_AFTER_POINT_IN_EXPONENTIAL = 64
|
||||||
};
|
};
|
||||||
|
|
||||||
// Flags should be a bit-or combination of the possible Flags-enum.
|
// Flags should be a bit-or combination of the possible Flags-enum.
|
||||||
@ -97,6 +99,13 @@ class DoubleToStringConverter {
|
|||||||
// of the result in precision mode. Matches printf's %g.
|
// of the result in precision mode. Matches printf's %g.
|
||||||
// When EMIT_TRAILING_ZERO_AFTER_POINT is also given, one trailing zero is
|
// When EMIT_TRAILING_ZERO_AFTER_POINT is also given, one trailing zero is
|
||||||
// preserved.
|
// preserved.
|
||||||
|
// - EMIT_TRAILING_DECIMAL_POINT_IN_EXPONENTIAL: when the input number has
|
||||||
|
// exactly one significant digit and is converted into exponent form then a
|
||||||
|
// trailing decimal point is appended to the significand in shortest mode
|
||||||
|
// or in precision mode with one requested digit.
|
||||||
|
// - EMIT_TRAILING_ZERO_AFTER_POINT_IN_EXPONENTIAL: in addition to a trailing
|
||||||
|
// decimal point emits a trailing '0'-character. This flag requires the
|
||||||
|
// EMIT_TRAILING_DECIMAL_POINT_IN_EXPONENTIAL flag.
|
||||||
//
|
//
|
||||||
// Infinity symbol and nan_symbol provide the string representation for these
|
// Infinity symbol and nan_symbol provide the string representation for these
|
||||||
// special values. If the string is NULL and the special value is encountered
|
// special values. If the string is NULL and the special value is encountered
|
||||||
@ -132,6 +141,22 @@ class DoubleToStringConverter {
|
|||||||
// ToPrecision(230.0, 2) -> "230." with EMIT_TRAILING_DECIMAL_POINT.
|
// ToPrecision(230.0, 2) -> "230." with EMIT_TRAILING_DECIMAL_POINT.
|
||||||
// ToPrecision(230.0, 2) -> "2.3e2" with EMIT_TRAILING_ZERO_AFTER_POINT.
|
// ToPrecision(230.0, 2) -> "2.3e2" with EMIT_TRAILING_ZERO_AFTER_POINT.
|
||||||
//
|
//
|
||||||
|
// When converting numbers with exactly one significant digit to exponent
|
||||||
|
// form in shortest mode or in precision mode with one requested digit, the
|
||||||
|
// EMIT_TRAILING_DECIMAL_POINT and EMIT_TRAILING_ZERO_AFTER_POINT flags have
|
||||||
|
// no effect. Use the EMIT_TRAILING_DECIMAL_POINT_IN_EXPONENTIAL flag to
|
||||||
|
// append a decimal point in this case and the
|
||||||
|
// EMIT_TRAILING_ZERO_AFTER_POINT_IN_EXPONENTIAL flag to also append a
|
||||||
|
// '0'-character in this case.
|
||||||
|
// Example with decimal_in_shortest_low = 0:
|
||||||
|
// ToShortest(0.0009) -> "9e-4"
|
||||||
|
// with EMIT_TRAILING_DECIMAL_POINT_IN_EXPONENTIAL deactivated.
|
||||||
|
// ToShortest(0.0009) -> "9.e-4"
|
||||||
|
// with EMIT_TRAILING_DECIMAL_POINT_IN_EXPONENTIAL activated.
|
||||||
|
// ToShortest(0.0009) -> "9.0e-4"
|
||||||
|
// with EMIT_TRAILING_DECIMAL_POINT_IN_EXPONENTIAL activated and
|
||||||
|
// EMIT_TRAILING_ZERO_AFTER_POINT_IN_EXPONENTIAL activated.
|
||||||
|
//
|
||||||
// The min_exponent_width is used for exponential representations.
|
// The min_exponent_width is used for exponential representations.
|
||||||
// The converter adds leading '0's to the exponent until the exponent
|
// The converter adds leading '0's to the exponent until the exponent
|
||||||
// is at least min_exponent_width digits long.
|
// is at least min_exponent_width digits long.
|
||||||
|
@ -5,8 +5,8 @@
|
|||||||
"QtUsage": "Used in Qt Core. Configure with -system-doubleconversion or -no-doubleconversion to avoid.",
|
"QtUsage": "Used in Qt Core. Configure with -system-doubleconversion or -no-doubleconversion to avoid.",
|
||||||
|
|
||||||
"Homepage": "https://github.com/google/double-conversion",
|
"Homepage": "https://github.com/google/double-conversion",
|
||||||
"Version": "3.2.1",
|
"Version": "3.3.0",
|
||||||
"DownloadLocation": "https://github.com/google/double-conversion/releases/tag/v3.2.1",
|
"DownloadLocation": "https://github.com/google/double-conversion/releases/tag/v3.3.0",
|
||||||
"License": "BSD 3-clause \"New\" or \"Revised\" License",
|
"License": "BSD 3-clause \"New\" or \"Revised\" License",
|
||||||
"LicenseId": "BSD-3-Clause",
|
"LicenseId": "BSD-3-Clause",
|
||||||
"LicenseFile": "LICENSE",
|
"LicenseFile": "LICENSE",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user