11 if (c >=
'A' && c <=
'Z')
18 return ((_c > 8 && _c < 14) || (_c == 32));
23 return (x < 0) ? -x : x;
28 return (x < 0) ? -x : x;
33 return (x < 0) ? -x : x;
50 else if (*nptr ==
'+')
55 while ((c = *nptr++) >=
'0' && c <=
'9')
57 val = val * 10 + (c -
'0');
60 return neg ? -val : val;
63unsigned long strtoul(
const char *restrict nptr,
char **restrict endptr,
int base)
65 return strtoll(nptr, endptr, base);
73s64 strntoll(
const char *str,
char **endptr,
int base,
size_t n)
76 bool negative =
false;
80 negative =
true, str++, i++;
87 if (c >=
'0' && c <=
'9')
88 result *= base, result += c -
'0';
89 else if (c >=
'a' && c <=
'z')
90 result *= base, result += c -
'a' + 10;
91 else if (c >=
'A' && c <=
'Z')
92 result *= base, result += c -
'A' + 10;
99 *endptr = (
char *) str;
100 return negative ? -result : result;
105 static const char *
const units[] = {
"B",
"KiB",
"MiB",
"GiB",
"TiB",
"PiB",
"EiB",
"ZiB",
"YiB" };
120 snprintf(buf, buf_size,
"%llu %s + %zu %s",
size, units[i], diff, units[i - 1]);
139 end = in +
strlen(in) - 1;
140 while (end > in && *end ==
' ')
s64 strtoll(const char *str, char **endptr, int base)
unsigned char tolower(unsigned char c)
void format_size(char *buf, size_t buf_size, u64 size)
s64 strntoll(const char *str, char **endptr, int base, size_t n)
char * string_trim(char *in)
s32 atoi(const char *nptr)
#define MOS_ARRAY_SIZE(x)
int snprintf(char *__restrict str, size_t size, const char *__restrict format,...)
unsigned long strtoul(const char *restrict nptr, char **restrict endptr, int base)
static int isspace(int _c)
static size_t strlen(const char *s)