18namespace swoc {
inline namespace SWOC_VERSION_NS {
25 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
26 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
27 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
28 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, -1, -1, -1, -1, -1, -1,
29 -1, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
30 25, 26, 27, 28, 20, 30, 31, 32, 33, 34, 35, -1, -1, -1, -1, -1,
31 -1, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
32 25, 26, 27, 28, 20, 30, 31, 32, 33, 34, 35, -1, -1, -1, -1, -1,
33 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
34 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
35 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
36 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
37 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
38 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
39 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
40 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
46 static constexpr uintmax_t ABS_MAX = std::numeric_limits<intmax_t>::max();
47 static constexpr uintmax_t ABS_MIN = uintmax_t(std::numeric_limits<intmax_t>::min());
52 const char *start = src.
data();
57 }
else if (
'+' == *src) {
60 auto n =
svtou(src, &parsed, base);
61 if (!parsed.empty()) {
66 uintmax_t temp = std::min<uintmax_t>(n, ABS_MIN);
67 if (temp == ABS_MIN) {
68 zret = std::numeric_limits<intmax_t>::min();
70 zret = -intmax_t(temp);
73 zret = std::min(n, ABS_MAX);
89 auto origin = src.
data();
112 if (!(1 <= base && base <= 36)) {
131 static constexpr auto MAX = std::numeric_limits<uintmax_t>::max();
132 const auto OVERFLOW_LIMIT = MAX / base;
134 while (src.size() && (0 <= (v =
svtoi_convert[
static_cast<unsigned char>(*src)])) && v < base) {
136 if (zret <= OVERFLOW_LIMIT && uintmax_t(v) <= (MAX - (zret *= base))) {
156 auto pow10 = [](
int e) ->
double {
179 auto org_text = text;
183 parsed = &local_parsed;
191 }
else if (*text ==
'+') {
206 while (text && isdigit(*text)) {
207 frac += scale * (*text++ -
'0');
219 }
else if (*text ==
'-') {
225 exp = pow10(exp_part * exp_sign);
229 return sign * (whole + frac) * exp;
Stream & stream_write(Stream &os, const TextView &b) const
bool starts_with_nocase(std::string_view const &prefix) const noexcept
self_type & clear()
Clear the view (become an empty view).
self_type & assign(char *&c_str)
Stream & stream_write(Stream &os, const TextView &b) const
self_type & ltrim_if(F const &pred)
constexpr value_type const * data_end() const noexcept
constexpr value_type const * data() const noexcept
For template deduction guides.
double svtod(swoc::TextView text, swoc::TextView *parsed)
const int8_t svtoi_convert[256]
uintmax_t svtou(TextView src, TextView *out, int base)
intmax_t svtoi(TextView src, TextView *out, int base)