OLD | NEW |
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 // This function should match the exact semantics of ECMA-262 9.5. | 68 // This function should match the exact semantics of ECMA-262 9.5. |
69 static inline int32_t DoubleToInt32(double x); | 69 static inline int32_t DoubleToInt32(double x); |
70 | 70 |
71 | 71 |
72 // This function should match the exact semantics of ECMA-262 9.6. | 72 // This function should match the exact semantics of ECMA-262 9.6. |
73 static inline uint32_t DoubleToUint32(double x) { | 73 static inline uint32_t DoubleToUint32(double x) { |
74 return static_cast<uint32_t>(DoubleToInt32(x)); | 74 return static_cast<uint32_t>(DoubleToInt32(x)); |
75 } | 75 } |
76 | 76 |
77 | 77 |
78 // Returns the value (0 .. 15) of a hexadecimal character c. | |
79 // If c is not a legal hexadecimal character, returns a value < 0. | |
80 int HexValue(uc32 c); | |
81 | |
82 | |
83 // Enumeration for allowing octals and ignoring junk when converting | 78 // Enumeration for allowing octals and ignoring junk when converting |
84 // strings to numbers. | 79 // strings to numbers. |
85 enum ConversionFlags { | 80 enum ConversionFlags { |
86 NO_FLAGS = 0, | 81 NO_FLAGS = 0, |
87 ALLOW_HEX = 1, | 82 ALLOW_HEX = 1, |
88 ALLOW_OCTALS = 2, | 83 ALLOW_OCTALS = 2, |
89 ALLOW_TRAILING_JUNK = 4 | 84 ALLOW_TRAILING_JUNK = 4 |
90 }; | 85 }; |
91 | 86 |
92 | 87 |
(...skipping 25 matching lines...) Expand all Loading... |
118 // Additional number to string conversions for the number type. | 113 // Additional number to string conversions for the number type. |
119 // The caller is responsible for calling free on the returned pointer. | 114 // The caller is responsible for calling free on the returned pointer. |
120 char* DoubleToFixedCString(double value, int f); | 115 char* DoubleToFixedCString(double value, int f); |
121 char* DoubleToExponentialCString(double value, int f); | 116 char* DoubleToExponentialCString(double value, int f); |
122 char* DoubleToPrecisionCString(double value, int f); | 117 char* DoubleToPrecisionCString(double value, int f); |
123 char* DoubleToRadixCString(double value, int radix); | 118 char* DoubleToRadixCString(double value, int radix); |
124 | 119 |
125 } } // namespace v8::internal | 120 } } // namespace v8::internal |
126 | 121 |
127 #endif // V8_CONVERSIONS_H_ | 122 #endif // V8_CONVERSIONS_H_ |
OLD | NEW |