Index: src/fixed-dtoa.cc |
=================================================================== |
--- src/fixed-dtoa.cc (revision 4592) |
+++ src/fixed-dtoa.cc (working copy) |
@@ -103,9 +103,9 @@ |
int BitAt(int position) { |
if (position >= 64) { |
- return (high_bits_ >> (position - 64)) & 1; |
+ return static_cast<int>(high_bits_ >> (position - 64)) & 1; |
} else { |
- return (low_bits_ >> position) & 1; |
+ return static_cast<int>(low_bits_ >> position) & 1; |
} |
} |
@@ -146,7 +146,8 @@ |
char tmp = buffer[i]; |
buffer[i] = buffer[j]; |
buffer[j] = tmp; |
- i++; j--; |
+ i++; |
+ j--; |
} |
*length += number_length; |
} |
@@ -156,10 +157,10 @@ |
Vector<char> buffer, int* length) { |
const uint32_t kTen7 = 10000000; |
// For efficiency cut the number into 3 uint32_t parts, and print those. |
- uint32_t part2 = number % kTen7; |
+ uint32_t part2 = static_cast<uint32_t>(number % kTen7); |
number /= kTen7; |
- uint32_t part1 = number % kTen7; |
- uint32_t part0 = number / kTen7; |
+ uint32_t part1 = static_cast<uint32_t>(number % kTen7); |
+ uint32_t part0 = static_cast<uint32_t>(number / kTen7); |
FillDigits32FixedLength(part0, 3, buffer, length); |
FillDigits32FixedLength(part1, 7, buffer, length); |
@@ -170,10 +171,10 @@ |
static void FillDigits64(uint64_t number, Vector<char> buffer, int* length) { |
const uint32_t kTen7 = 10000000; |
// For efficiency cut the number into 3 uint32_t parts, and print those. |
- uint32_t part2 = number % kTen7; |
+ uint32_t part2 = static_cast<uint32_t>(number % kTen7); |
number /= kTen7; |
- uint32_t part1 = number % kTen7; |
- uint32_t part0 = number / kTen7; |
+ uint32_t part1 = static_cast<uint32_t>(number % kTen7); |
+ uint32_t part0 = static_cast<uint32_t>(number / kTen7); |
if (part0 != 0) { |
FillDigits32(part0, buffer, length); |
@@ -249,9 +250,9 @@ |
// After each iteration the point is decremented by one. |
// Note that 5^3 = 125 < 128 = 2^7. |
// Therefore three iterations of this loop will not overflow fractionals |
- // (even without the subtraction at the end of the loop body). At this time |
- // point will satisfy point <= 61 and therefore fractionals < 2^point and |
- // any further multiplication of fractionals by 5 will not overflow. |
+ // (even without the subtraction at the end of the loop body). At this |
+ // time point will satisfy point <= 61 and therefore fractionals < 2^point |
+ // and any further multiplication of fractionals by 5 will not overflow. |
fractionals *= 5; |
point--; |
int digit = static_cast<int>(fractionals >> point); |
@@ -338,7 +339,7 @@ |
uint64_t divisor = kFive17; |
int divisor_power = 17; |
uint64_t dividend = significand; |
- uint64_t quotient; |
+ uint32_t quotient; |
uint64_t remainder; |
// Let v = f * 2^e with f == significand and e == exponent. |
// Then need q (quotient) and r (remainder) as follows: |
@@ -352,11 +353,11 @@ |
if (exponent > divisor_power) { |
// We only allow exponents of up to 20 and therefore (17 - e) <= 3 |
dividend <<= exponent - divisor_power; |
- quotient = dividend / divisor; |
+ quotient = static_cast<uint32_t>(dividend / divisor); |
remainder = (dividend % divisor) << divisor_power; |
} else { |
divisor <<= divisor_power - exponent; |
- quotient = dividend / divisor; |
+ quotient = static_cast<uint32_t>(dividend / divisor); |
remainder = (dividend % divisor) << exponent; |
} |
FillDigits32(quotient, buffer, length); |