diff options
author | Edward Welbourne <edward.welbourne@qt.io> | 2021-01-20 18:47:22 +0100 |
---|---|---|
committer | Edward Welbourne <edward.welbourne@qt.io> | 2021-02-01 14:31:30 +0100 |
commit | 658b93386eea34398de3ddacab436601e1ab5bbb (patch) | |
tree | ee37dcaa755bd7b557d36fbcfd11bd6f7d89af8d /src/3rdparty/double-conversion/fixed-dtoa.cc | |
parent | 784c443ab02d2a53e3a746c122e10e0f494a869e (diff) |
Update double-conversion library to current master
Turned our local diffs into a side-branch in the upstream repo, got
material changes upstreamed (leaving only our #include changes),
rebased it to master, copied back to our version. Upstream has made no
new release since 3.1.5 in 2019 May, but there is substantial change
since then, including acceptance of our upstreaming. Our patches have
been refined in the process of upstreaming.
The list of source files is slightly changed. The double-conversion.*
files are split in two, string-to-double.* and double-to-string.*, but
the old double-conversion.h header is retained, simply pulling in its
two halves. These thus need to be present in the include directory.
Changed the patches/ directory to be in git format-patch form, for
sending or applying to the upstream repo, before copying files into
the qtbase source tree. This should make future upstreaming easier.
Task-number: QTBUG-90214
Change-Id: Id94198f58ef7bdf02af117c35cb9678b5c34ac0e
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/3rdparty/double-conversion/fixed-dtoa.cc')
-rw-r--r-- | src/3rdparty/double-conversion/fixed-dtoa.cc | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/3rdparty/double-conversion/fixed-dtoa.cc b/src/3rdparty/double-conversion/fixed-dtoa.cc index 8c111aca64..3e04a6325c 100644 --- a/src/3rdparty/double-conversion/fixed-dtoa.cc +++ b/src/3rdparty/double-conversion/fixed-dtoa.cc @@ -53,11 +53,11 @@ class UInt128 { accumulator >>= 32; accumulator = accumulator + (high_bits_ >> 32) * multiplicand; high_bits_ = (accumulator << 32) + part; - ASSERT((accumulator >> 32) == 0); + DOUBLE_CONVERSION_ASSERT((accumulator >> 32) == 0); } void Shift(int shift_amount) { - ASSERT(-64 <= shift_amount && shift_amount <= 64); + DOUBLE_CONVERSION_ASSERT(-64 <= shift_amount && shift_amount <= 64); if (shift_amount == 0) { return; } else if (shift_amount == -64) { @@ -230,13 +230,13 @@ static void RoundUp(Vector<char> buffer, int* length, int* decimal_point) { static void FillFractionals(uint64_t fractionals, int exponent, int fractional_count, Vector<char> buffer, int* length, int* decimal_point) { - ASSERT(-128 <= exponent && exponent <= 0); + DOUBLE_CONVERSION_ASSERT(-128 <= exponent && exponent <= 0); // 'fractionals' is a fixed-point number, with binary point at bit // (-exponent). Inside the function the non-converted remainder of fractionals // is a fixed-point number, with binary point at bit 'point'. if (-exponent <= 64) { // One 64 bit number is sufficient. - ASSERT(fractionals >> 56 == 0); + DOUBLE_CONVERSION_ASSERT(fractionals >> 56 == 0); int point = -exponent; for (int i = 0; i < fractional_count; ++i) { if (fractionals == 0) break; @@ -253,18 +253,18 @@ static void FillFractionals(uint64_t fractionals, int exponent, fractionals *= 5; point--; int digit = static_cast<int>(fractionals >> point); - ASSERT(digit <= 9); + DOUBLE_CONVERSION_ASSERT(digit <= 9); buffer[*length] = static_cast<char>('0' + digit); (*length)++; fractionals -= static_cast<uint64_t>(digit) << point; } // If the first bit after the point is set we have to round up. - ASSERT(fractionals == 0 || point - 1 >= 0); + DOUBLE_CONVERSION_ASSERT(fractionals == 0 || point - 1 >= 0); if ((fractionals != 0) && ((fractionals >> (point - 1)) & 1) == 1) { RoundUp(buffer, length, decimal_point); } } else { // We need 128 bits. - ASSERT(64 < -exponent && -exponent <= 128); + DOUBLE_CONVERSION_ASSERT(64 < -exponent && -exponent <= 128); UInt128 fractionals128 = UInt128(fractionals, 0); fractionals128.Shift(-exponent - 64); int point = 128; @@ -276,7 +276,7 @@ static void FillFractionals(uint64_t fractionals, int exponent, fractionals128.Multiply(5); point--; int digit = fractionals128.DivModPowerOf2(point); - ASSERT(digit <= 9); + DOUBLE_CONVERSION_ASSERT(digit <= 9); buffer[*length] = static_cast<char>('0' + digit); (*length)++; } @@ -335,7 +335,7 @@ bool FastFixedDtoa(double v, // The quotient delivers the first digits, and the remainder fits into a 64 // bit number. // Dividing by 10^17 is equivalent to dividing by 5^17*2^17. - const uint64_t kFive17 = UINT64_2PART_C(0xB1, A2BC2EC5); // 5^17 + const uint64_t kFive17 = DOUBLE_CONVERSION_UINT64_2PART_C(0xB1, A2BC2EC5); // 5^17 uint64_t divisor = kFive17; int divisor_power = 17; uint64_t dividend = significand; @@ -383,7 +383,7 @@ bool FastFixedDtoa(double v, } else if (exponent < -128) { // This configuration (with at most 20 digits) means that all digits must be // 0. - ASSERT(fractional_count <= 20); + DOUBLE_CONVERSION_ASSERT(fractional_count <= 20); buffer[0] = '\0'; *length = 0; *decimal_point = -fractional_count; |