OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 29 matching lines...) Expand all Loading... |
40 #include "conversions.h" | 40 #include "conversions.h" |
41 #include "double.h" | 41 #include "double.h" |
42 #include "platform.h" | 42 #include "platform.h" |
43 #include "scanner.h" | 43 #include "scanner.h" |
44 #include "strtod.h" | 44 #include "strtod.h" |
45 | 45 |
46 namespace v8 { | 46 namespace v8 { |
47 namespace internal { | 47 namespace internal { |
48 | 48 |
49 static inline double JunkStringValue() { | 49 static inline double JunkStringValue() { |
50 return std::numeric_limits<double>::quiet_NaN(); | 50 return BitCast<double, uint64_t>(kQuietNaNMask); |
51 } | 51 } |
52 | 52 |
53 | 53 |
54 // The fast double-to-unsigned-int conversion routine does not guarantee | 54 // The fast double-to-unsigned-int conversion routine does not guarantee |
55 // rounding towards zero, or any reasonable value if the argument is larger | 55 // rounding towards zero, or any reasonable value if the argument is larger |
56 // than what fits in an unsigned 32-bit integer. | 56 // than what fits in an unsigned 32-bit integer. |
57 static inline unsigned int FastD2UI(double x) { | 57 static inline unsigned int FastD2UI(double x) { |
58 // There is no unsigned version of lrint, so there is no fast path | 58 // There is no unsigned version of lrint, so there is no fast path |
59 // in this function as there is in FastD2I. Using lrint doesn't work | 59 // in this function as there is in FastD2I. Using lrint doesn't work |
60 // for values of 2^31 and above. | 60 // for values of 2^31 and above. |
(...skipping 600 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
661 ASSERT(buffer_pos < kBufferSize); | 661 ASSERT(buffer_pos < kBufferSize); |
662 buffer[buffer_pos] = '\0'; | 662 buffer[buffer_pos] = '\0'; |
663 | 663 |
664 double converted = Strtod(Vector<const char>(buffer, buffer_pos), exponent); | 664 double converted = Strtod(Vector<const char>(buffer, buffer_pos), exponent); |
665 return negative ? -converted : converted; | 665 return negative ? -converted : converted; |
666 } | 666 } |
667 | 667 |
668 } } // namespace v8::internal | 668 } } // namespace v8::internal |
669 | 669 |
670 #endif // V8_CONVERSIONS_INL_H_ | 670 #endif // V8_CONVERSIONS_INL_H_ |
OLD | NEW |