aboutsummaryrefslogtreecommitdiffstats
path: root/src/3rdparty/double-conversion/fast-dtoa.cc
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@digia.com>2014-01-22 12:53:09 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-01-24 12:39:02 +0100
commit998860f00ca1c9eb333787595e05e8cb486802c8 (patch)
treecf1dc15635797fd3283f1ee8e87bc1fd4bb1b693 /src/3rdparty/double-conversion/fast-dtoa.cc
parent9fb297a54bd0226b4827b5d7ca093a7f9c4922fa (diff)
Update our double conversion code to the latest release from code.google.com
This fixes AArch64 builds and brings us in sync with upstream commit 2fb03de56faa32bbba5e02222528e7b760f71d77 Task-number: QTBUG-35528 Change-Id: Ib356627e06c1fecaa5b3f66d0a98fb5b30dc87e5 Reviewed-by: Liang Qi <liang.qi@digia.com> Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'src/3rdparty/double-conversion/fast-dtoa.cc')
-rw-r--r--src/3rdparty/double-conversion/fast-dtoa.cc19
1 files changed, 10 insertions, 9 deletions
diff --git a/src/3rdparty/double-conversion/fast-dtoa.cc b/src/3rdparty/double-conversion/fast-dtoa.cc
index 1a0f823509..61350383a9 100644
--- a/src/3rdparty/double-conversion/fast-dtoa.cc
+++ b/src/3rdparty/double-conversion/fast-dtoa.cc
@@ -248,10 +248,7 @@ static void BiggestPowerTen(uint32_t number,
// Note: kPowersOf10[i] == 10^(i-1).
exponent_plus_one_guess++;
// We don't have any guarantees that 2^number_bits <= number.
- // TODO(floitsch): can we change the 'while' into an 'if'? We definitely see
- // number < (2^number_bits - 1), but I haven't encountered
- // number < (2^number_bits - 2) yet.
- while (number < kSmallPowersOfTen[exponent_plus_one_guess]) {
+ if (number < kSmallPowersOfTen[exponent_plus_one_guess]) {
exponent_plus_one_guess--;
}
*power = kSmallPowersOfTen[exponent_plus_one_guess];
@@ -350,7 +347,8 @@ static bool DigitGen(DiyFp low,
// that is smaller than integrals.
while (*kappa > 0) {
int digit = integrals / divisor;
- buffer[*length] = '0' + digit;
+ ASSERT(digit <= 9);
+ buffer[*length] = static_cast<char>('0' + digit);
(*length)++;
integrals %= divisor;
(*kappa)--;
@@ -379,13 +377,14 @@ static bool DigitGen(DiyFp low,
ASSERT(one.e() >= -60);
ASSERT(fractionals < one.f());
ASSERT(UINT64_2PART_C(0xFFFFFFFF, FFFFFFFF) / 10 >= one.f());
- while (true) {
+ for (;;) {
fractionals *= 10;
unit *= 10;
unsafe_interval.set_f(unsafe_interval.f() * 10);
// Integer division by one.
int digit = static_cast<int>(fractionals >> -one.e());
- buffer[*length] = '0' + digit;
+ ASSERT(digit <= 9);
+ buffer[*length] = static_cast<char>('0' + digit);
(*length)++;
fractionals &= one.f() - 1; // Modulo by one.
(*kappa)--;
@@ -459,7 +458,8 @@ static bool DigitGenCounted(DiyFp w,
// that is smaller than 'integrals'.
while (*kappa > 0) {
int digit = integrals / divisor;
- buffer[*length] = '0' + digit;
+ ASSERT(digit <= 9);
+ buffer[*length] = static_cast<char>('0' + digit);
(*length)++;
requested_digits--;
integrals %= divisor;
@@ -492,7 +492,8 @@ static bool DigitGenCounted(DiyFp w,
w_error *= 10;
// Integer division by one.
int digit = static_cast<int>(fractionals >> -one.e());
- buffer[*length] = '0' + digit;
+ ASSERT(digit <= 9);
+ buffer[*length] = static_cast<char>('0' + digit);
(*length)++;
requested_digits--;
fractionals &= one.f() - 1; // Modulo by one.