61strtoll (
const char *nptr,
char **endptr,
int base)
63 register const char *s = nptr;
64 register uint64_t acc;
66 register uint64_t cutoff;
67 register int neg = 0, any, cutlim;
82 if ((base == 0 || base == 16) && c ==
'0' && (*s ==
'x' || *s ==
'X')) {
88 base = c ==
'0' ? 8 : 10;
108 cutlim = cutoff % (uint64_t) base;
109 cutoff /= (uint64_t) base;
110 for (acc = 0, any = 0;; c = *s++) {
114 c -=
xisupper(c) ?
'A' - 10 :
'a' - 10;
119 if (any < 0 || acc > cutoff || (acc == cutoff && c > cutlim))
133 *endptr = (
char *) (any ? s - 1 : nptr);
int64_t strtoll(const char *nptr, char **endptr, int base)