1
0

wcstoll.c 342 B

123456789101112131415161718
  1. #include <wchar.h>
  2. #include <stdlib.h>
  3. #include <inttypes.h>
  4. #include <errno.h>
  5. #include <limits.h>
  6. long long wcstoll(const wchar_t *s, wchar_t **p, int base)
  7. {
  8. intmax_t x = wcstoimax(s, p, base);
  9. if (x > LLONG_MAX) {
  10. errno = ERANGE;
  11. return LLONG_MAX;
  12. } else if (x < LLONG_MIN) {
  13. errno = ERANGE;
  14. return LLONG_MIN;
  15. }
  16. return x;
  17. }