new scanf implementation and corresponding integer parser/converter
[musl] / src / stdlib / wcstoull.c
1 #include <wchar.h>
2 #include <stdlib.h>
3 #include <inttypes.h>
4 #include <errno.h>
5 #include <limits.h>
6
7 unsigned long long wcstoull(const wchar_t *s, wchar_t **p, int base)
8 {
9         intmax_t x;
10         if (sizeof(intmax_t) == sizeof(long long))
11                 return wcstoumax(s, p, base);
12         x = wcstoimax(s, p, base);
13         if (-x > ULLONG_MAX || x > ULLONG_MAX) {
14                 errno = ERANGE;
15                 return ULLONG_MAX;
16         }
17         return x;
18 }