| OLD | NEW |
| 1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 | 27 |
| 28 #include "config.h" | 28 #include "config.h" |
| 29 | 29 |
| 30 #include <math.h> | 30 #include <math.h> |
| 31 | 31 |
| 32 #include "double.h" | 32 #include "double.h" |
| 33 #include "fixed-dtoa.h" | 33 #include "fixed-dtoa.h" |
| 34 #include "wtf/UnusedParam.h" | |
| 35 | 34 |
| 36 namespace WTF { | 35 namespace WTF { |
| 37 | 36 |
| 38 namespace double_conversion { | 37 namespace double_conversion { |
| 39 | 38 |
| 40 // Represents a 128bit type. This class should be replaced by a native type
on | 39 // Represents a 128bit type. This class should be replaced by a native type
on |
| 41 // platforms that support 128bit integers. | 40 // platforms that support 128bit integers. |
| 42 class UInt128 { | 41 class UInt128 { |
| 43 public: | 42 public: |
| 44 UInt128() : high_bits_(0), low_bits_(0) { } | 43 UInt128() : high_bits_(0), low_bits_(0) { } |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 char tmp = buffer[i]; | 147 char tmp = buffer[i]; |
| 149 buffer[i] = buffer[j]; | 148 buffer[i] = buffer[j]; |
| 150 buffer[j] = tmp; | 149 buffer[j] = tmp; |
| 151 i++; | 150 i++; |
| 152 j--; | 151 j--; |
| 153 } | 152 } |
| 154 *length += number_length; | 153 *length += number_length; |
| 155 } | 154 } |
| 156 | 155 |
| 157 | 156 |
| 158 static void FillDigits64FixedLength(uint64_t number, int requested_length, | 157 static void FillDigits64FixedLength(uint64_t number, int, |
| 159 Vector<char> buffer, int* length) { | 158 Vector<char> buffer, int* length) { |
| 160 UNUSED_PARAM(requested_length); | |
| 161 const uint32_t kTen7 = 10000000; | 159 const uint32_t kTen7 = 10000000; |
| 162 // For efficiency cut the number into 3 uint32_t parts, and print those. | 160 // For efficiency cut the number into 3 uint32_t parts, and print those. |
| 163 uint32_t part2 = static_cast<uint32_t>(number % kTen7); | 161 uint32_t part2 = static_cast<uint32_t>(number % kTen7); |
| 164 number /= kTen7; | 162 number /= kTen7; |
| 165 uint32_t part1 = static_cast<uint32_t>(number % kTen7); | 163 uint32_t part1 = static_cast<uint32_t>(number % kTen7); |
| 166 uint32_t part0 = static_cast<uint32_t>(number / kTen7); | 164 uint32_t part0 = static_cast<uint32_t>(number / kTen7); |
| 167 | 165 |
| 168 FillDigits32FixedLength(part0, 3, buffer, length); | 166 FillDigits32FixedLength(part0, 3, buffer, length); |
| 169 FillDigits32FixedLength(part1, 7, buffer, length); | 167 FillDigits32FixedLength(part1, 7, buffer, length); |
| 170 FillDigits32FixedLength(part2, 7, buffer, length); | 168 FillDigits32FixedLength(part2, 7, buffer, length); |
| (...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 401 // The string is empty and the decimal_point thus has no importance.
Mimick | 399 // The string is empty and the decimal_point thus has no importance.
Mimick |
| 402 // Gay's dtoa and and set it to -fractional_count. | 400 // Gay's dtoa and and set it to -fractional_count. |
| 403 *decimal_point = -fractional_count; | 401 *decimal_point = -fractional_count; |
| 404 } | 402 } |
| 405 return true; | 403 return true; |
| 406 } | 404 } |
| 407 | 405 |
| 408 } // namespace double_conversion | 406 } // namespace double_conversion |
| 409 | 407 |
| 410 } // namespace WTF | 408 } // namespace WTF |
| OLD | NEW |