mirror of
https://github.com/dart-lang/sdk
synced 2024-09-19 21:01:50 +00:00
Fix performance of parsing Mints.
Review URL: https://codereview.chromium.org//13852044 git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@21767 260f80e4-7a28-3924-810f-c04153c831b5
This commit is contained in:
parent
6c60285f23
commit
cc94080d4d
|
@ -193,10 +193,10 @@ DEFINE_NATIVE_ENTRY(Integer_parse, 1) {
|
|||
// a) '+5' is not a valid integer (leading plus).
|
||||
if (cstr[0] != '+') {
|
||||
char* p_end = NULL;
|
||||
const int64_t int_value = strtol(cstr, &p_end, 10);
|
||||
const int64_t int_value = strtoll(cstr, &p_end, 10);
|
||||
if (p_end == (cstr + len)) {
|
||||
if ((Smi::kMinValue <= int_value) && (int_value <= Smi::kMaxValue)) {
|
||||
return Smi::New(int_value);
|
||||
if ((int_value != LLONG_MIN) && (int_value != LLONG_MAX)) {
|
||||
return Integer::New(int_value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -65,4 +65,10 @@ static inline double round(double x) {
|
|||
}
|
||||
}
|
||||
|
||||
// Windows does not have strtoll defined.
|
||||
#if defined(_MSC_VER)
|
||||
#define strtoll _strtoi64
|
||||
#endif
|
||||
|
||||
|
||||
#endif // PLATFORM_C99_SUPPORT_WIN_H_
|
||||
|
|
Loading…
Reference in a new issue