initial check-in, version 0.5.0
[musl] / src / stdlib / wcstoll.c
1 #include <wchar.h>
2 #include <stdlib.h>
3 #include <inttypes.h>
4 #include <errno.h>
5 #include <limits.h>
6
7 long long wcstoll(const wchar_t *s, wchar_t **p, int base)
8 {
9         intmax_t x = wcstoimax(s, p, base);
10         if (x > LLONG_MAX) {
11                 errno = ERANGE;
12                 return LLONG_MAX;
13         } else if (x < LLONG_MIN) {
14                 errno = ERANGE;
15                 return LLONG_MIN;
16         }
17         return x;
18 }