OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8_CONVERSIONS_INL_H_ | 5 #ifndef V8_CONVERSIONS_INL_H_ |
6 #define V8_CONVERSIONS_INL_H_ | 6 #define V8_CONVERSIONS_INL_H_ |
7 | 7 |
8 #include <float.h> // Required for DBL_MAX and on Win32 for finite() | 8 #include <float.h> // Required for DBL_MAX and on Win32 for finite() |
9 #include <limits.h> // Required for INT_MAX etc. | 9 #include <limits.h> // Required for INT_MAX etc. |
10 #include <stdarg.h> | 10 #include <stdarg.h> |
11 #include <cmath> | 11 #include <cmath> |
12 #include "src/globals.h" // Required for V8_INFINITY | 12 #include "src/globals.h" // Required for V8_INFINITY |
13 | 13 |
14 // ---------------------------------------------------------------------------- | 14 // ---------------------------------------------------------------------------- |
15 // Extra POSIX/ANSI functions for Win32/MSVC. | 15 // Extra POSIX/ANSI functions for Win32/MSVC. |
16 | 16 |
17 #include "src/base/bits.h" | 17 #include "src/base/bits.h" |
18 #include "src/base/platform/platform.h" | 18 #include "src/base/platform/platform.h" |
19 #include "src/conversions.h" | 19 #include "src/conversions.h" |
20 #include "src/double.h" | 20 #include "src/double.h" |
21 #include "src/scanner.h" | 21 #include "src/scanner.h" |
22 #include "src/strtod.h" | 22 #include "src/strtod.h" |
23 | 23 |
24 namespace v8 { | 24 namespace v8 { |
25 namespace internal { | 25 namespace internal { |
26 | 26 |
27 inline double JunkStringValue() { | 27 inline double JunkStringValue() { |
28 return BitCast<double, uint64_t>(kQuietNaNMask); | 28 return bit_cast<double, uint64_t>(kQuietNaNMask); |
29 } | 29 } |
30 | 30 |
31 | 31 |
32 inline double SignedZero(bool negative) { | 32 inline double SignedZero(bool negative) { |
33 return negative ? uint64_to_double(Double::kSignMask) : 0.0; | 33 return negative ? uint64_to_double(Double::kSignMask) : 0.0; |
34 } | 34 } |
35 | 35 |
36 | 36 |
37 // The fast double-to-unsigned-int conversion routine does not guarantee | 37 // The fast double-to-unsigned-int conversion routine does not guarantee |
38 // rounding towards zero, or any reasonable value if the argument is larger | 38 // rounding towards zero, or any reasonable value if the argument is larger |
(...skipping 638 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
677 SLOW_DCHECK(buffer_pos < kBufferSize); | 677 SLOW_DCHECK(buffer_pos < kBufferSize); |
678 buffer[buffer_pos] = '\0'; | 678 buffer[buffer_pos] = '\0'; |
679 | 679 |
680 double converted = Strtod(Vector<const char>(buffer, buffer_pos), exponent); | 680 double converted = Strtod(Vector<const char>(buffer, buffer_pos), exponent); |
681 return (sign == NEGATIVE) ? -converted : converted; | 681 return (sign == NEGATIVE) ? -converted : converted; |
682 } | 682 } |
683 | 683 |
684 } } // namespace v8::internal | 684 } } // namespace v8::internal |
685 | 685 |
686 #endif // V8_CONVERSIONS_INL_H_ | 686 #endif // V8_CONVERSIONS_INL_H_ |
OLD | NEW |