diff --git a/runtime/lib/integers.cc b/runtime/lib/integers.cc index f6133dd62b0..86492d1a4bd 100644 --- a/runtime/lib/integers.cc +++ b/runtime/lib/integers.cc @@ -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); } } } diff --git a/runtime/platform/c99_support_win.h b/runtime/platform/c99_support_win.h index 2859f0c970b..71ec1270974 100644 --- a/runtime/platform/c99_support_win.h +++ b/runtime/platform/c99_support_win.h @@ -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_