| 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 | 46 |
| 47 | 47 |
| 48 inline bool isDigit(int x, int radix) { | 48 inline bool isDigit(int x, int radix) { |
| 49 return (x >= '0' && x <= '9' && x < '0' + radix) | 49 return (x >= '0' && x <= '9' && x < '0' + radix) |
| 50 || (radix > 10 && x >= 'a' && x < 'a' + radix - 10) | 50 || (radix > 10 && x >= 'a' && x < 'a' + radix - 10) |
| 51 || (radix > 10 && x >= 'A' && x < 'A' + radix - 10); | 51 || (radix > 10 && x >= 'A' && x < 'A' + radix - 10); |
| 52 } | 52 } |
| 53 | 53 |
| 54 | 54 |
| 55 inline double SignedZero(bool negative) { | 55 inline double SignedZero(bool negative) { |
| 56 return negative ? -0.0 : 0.0; | 56 return negative ? BitCast<double, uint64_t>(Double::kSignMask) : 0.0; |
| 57 } | 57 } |
| 58 | 58 |
| 59 | 59 |
| 60 // The fast double-to-(unsigned-)int conversion routine does not guarantee | 60 // The fast double-to-(unsigned-)int conversion routine does not guarantee |
| 61 // rounding towards zero. | 61 // rounding towards zero. |
| 62 // For NaN and values outside the int range, return INT_MIN or INT_MAX. | 62 // For NaN and values outside the int range, return INT_MIN or INT_MAX. |
| 63 inline int FastD2IChecked(double x) { | 63 inline int FastD2IChecked(double x) { |
| 64 if (!(x >= INT_MIN)) return INT_MIN; // Negation to catch NaNs. | 64 if (!(x >= INT_MIN)) return INT_MIN; // Negation to catch NaNs. |
| 65 if (x > INT_MAX) return INT_MAX; | 65 if (x > INT_MAX) return INT_MAX; |
| 66 return static_cast<int>(x); | 66 return static_cast<int>(x); |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 // Additional number to string conversions for the number type. | 147 // Additional number to string conversions for the number type. |
| 148 // The caller is responsible for calling free on the returned pointer. | 148 // The caller is responsible for calling free on the returned pointer. |
| 149 char* DoubleToFixedCString(double value, int f); | 149 char* DoubleToFixedCString(double value, int f); |
| 150 char* DoubleToExponentialCString(double value, int f); | 150 char* DoubleToExponentialCString(double value, int f); |
| 151 char* DoubleToPrecisionCString(double value, int f); | 151 char* DoubleToPrecisionCString(double value, int f); |
| 152 char* DoubleToRadixCString(double value, int radix); | 152 char* DoubleToRadixCString(double value, int radix); |
| 153 | 153 |
| 154 } } // namespace v8::internal | 154 } } // namespace v8::internal |
| 155 | 155 |
| 156 #endif // V8_CONVERSIONS_H_ | 156 #endif // V8_CONVERSIONS_H_ |
| OLD | NEW |