in include/spotify/json/codec/number.hpp [151:172]
json_never_inline T decode_integer_range_with_overflow(
decode_context & /*context*/,
const char *begin,
const char *end,
const T initial_value,
bool &did_overflow) {
T value = initial_value;
using intops = integer_ops<T, is_positive>;
for (auto it = begin; it != end; ++it) {
const auto c = (*it);
const auto i = to_integer<T>(c);
const auto old_value = value;
value = intops::accumulate(value * 10, i);
if (json_unlikely(intops::is_overflow(old_value, value))) {
did_overflow = true;
return old_value;
}
}
return value;
}