auto const wasE = *in == 'e' || *in == 'E';
constexpr const char* maxInt = "9223372036854775807";
- constexpr const char* minInt = "9223372036854775808";
+ constexpr const char* minInt = "-9223372036854775808";
constexpr auto maxIntLen = constexpr_strlen(maxInt);
-
+ constexpr auto minIntLen = constexpr_strlen(minInt);
if (*in != '.' && !wasE && in.getOpts().parse_numbers_as_strings) {
return integral;
if (*in != '.' && !wasE) {
if (LIKELY(!in.getOpts().double_fallback || integral.size() < maxIntLen) ||
- (integral.size() == maxIntLen &&
- (integral <= maxInt || (integral == minInt && negative)))) {
+ (!negative && integral.size() == maxIntLen && integral <= maxInt) ||
+ (negative && integral.size() == minIntLen && integral <= minInt)) {
auto val = to<int64_t>(integral);
in.skipWhitespace();
return val;
return c < 10 ? c + '0' : c - 10 + 'a';
};
- out.reserve(out.size() + input.size() + 2);
out.push_back('\"');
auto* p = reinterpret_cast<const unsigned char*>(input.begin());