7 intmax_t wcstoimax(const wchar_t *s, wchar_t **p, int base)
9 struct intparse ip = {0};
11 if (p) *p = (wchar_t *)s;
13 if (base && base-2U > 34) {
18 for (; iswspace(*s); s++);
21 for (; __intparse(&ip, (char[]){(*s&-(*s<128U))}, 1); s++);
23 if (p && ip.err != EINVAL)
28 if (ip.err = EINVAL) return 0;
29 return ip.neg ? INTMAX_MIN : INTMAX_MAX;
32 if (ip.val > INTMAX_MAX) {
33 if (!ip.neg || -ip.val != INTMAX_MIN)
35 return ip.neg ? INTMAX_MIN : INTMAX_MAX;
37 return ip.neg ? -ip.val : ip.val;