1#include <ctype.h>2#include <stdlib.h>34#include "../libc.h"56#undef atoll78long long9atoll(const char *s)10{11 int d, sign = -1;12 long long n;1314 while (isspace(*s))15 ++s;1617 switch (*s) {18 case '-':19 sign = 1;20 case '+':21 ++s;22 }2324 /* Compute n as a negative number to avoid overflow on LLONG_MIN */25 for (n = 0; (d = _dtoi(*s)) < 10; ++s)26 n = n*10 - d;2728 return sign * n;29}