| 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 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 260 if (radix == 0) { | 260 if (radix == 0) { |
| 261 // Radix detection. | 261 // Radix detection. |
| 262 if (*current == '0') { | 262 if (*current == '0') { |
| 263 ++current; | 263 ++current; |
| 264 if (current == end) return SignedZero(negative); | 264 if (current == end) return SignedZero(negative); |
| 265 if (*current == 'x' || *current == 'X') { | 265 if (*current == 'x' || *current == 'X') { |
| 266 radix = 16; | 266 radix = 16; |
| 267 ++current; | 267 ++current; |
| 268 if (current == end) return JunkStringValue(); | 268 if (current == end) return JunkStringValue(); |
| 269 } else { | 269 } else { |
| 270 radix = 8; | 270 radix = 10; |
| 271 leading_zero = true; | 271 leading_zero = true; |
| 272 } | 272 } |
| 273 } else { | 273 } else { |
| 274 radix = 10; | 274 radix = 10; |
| 275 } | 275 } |
| 276 } else if (radix == 16) { | 276 } else if (radix == 16) { |
| 277 if (*current == '0') { | 277 if (*current == '0') { |
| 278 // Allow "0x" prefix. | 278 // Allow "0x" prefix. |
| 279 ++current; | 279 ++current; |
| 280 if (current == end) return SignedZero(negative); | 280 if (current == end) return SignedZero(negative); |
| (...skipping 374 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 |