| 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 26 matching lines...) Expand all Loading... |
| 37 // Extra POSIX/ANSI functions for Win32/MSVC. | 37 // Extra POSIX/ANSI functions for Win32/MSVC. |
| 38 | 38 |
| 39 #include "conversions.h" | 39 #include "conversions.h" |
| 40 #include "strtod.h" | 40 #include "strtod.h" |
| 41 #include "platform.h" | 41 #include "platform.h" |
| 42 | 42 |
| 43 namespace v8 { | 43 namespace v8 { |
| 44 namespace internal { | 44 namespace internal { |
| 45 | 45 |
| 46 static inline double JunkStringValue() { | 46 static inline double JunkStringValue() { |
| 47 return std::numeric_limits<double>::quiet_NaN(); | 47 return BitCast<double, uint64_t>(kQuietNaNMask); |
| 48 } | 48 } |
| 49 | 49 |
| 50 | 50 |
| 51 // The fast double-to-unsigned-int conversion routine does not guarantee | 51 // The fast double-to-unsigned-int conversion routine does not guarantee |
| 52 // rounding towards zero, or any reasonable value if the argument is larger | 52 // rounding towards zero, or any reasonable value if the argument is larger |
| 53 // than what fits in an unsigned 32-bit integer. | 53 // than what fits in an unsigned 32-bit integer. |
| 54 static inline unsigned int FastD2UI(double x) { | 54 static inline unsigned int FastD2UI(double x) { |
| 55 // There is no unsigned version of lrint, so there is no fast path | 55 // There is no unsigned version of lrint, so there is no fast path |
| 56 // in this function as there is in FastD2I. Using lrint doesn't work | 56 // in this function as there is in FastD2I. Using lrint doesn't work |
| 57 // for values of 2^31 and above. | 57 // for values of 2^31 and above. |
| (...skipping 597 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 655 ASSERT(buffer_pos < kBufferSize); | 655 ASSERT(buffer_pos < kBufferSize); |
| 656 buffer[buffer_pos] = '\0'; | 656 buffer[buffer_pos] = '\0'; |
| 657 | 657 |
| 658 double converted = Strtod(Vector<const char>(buffer, buffer_pos), exponent); | 658 double converted = Strtod(Vector<const char>(buffer, buffer_pos), exponent); |
| 659 return negative ? -converted : converted; | 659 return negative ? -converted : converted; |
| 660 } | 660 } |
| 661 | 661 |
| 662 } } // namespace v8::internal | 662 } } // namespace v8::internal |
| 663 | 663 |
| 664 #endif // V8_CONVERSIONS_INL_H_ | 664 #endif // V8_CONVERSIONS_INL_H_ |
| OLD | NEW |