X-Git-Url: http://nsz.repo.hu/git/?p=musl;a=blobdiff_plain;f=src%2Fstdlib%2Fwcstoull.c;h=48c557db59d77889e8095098c7478cd7a0d37fd0;hp=e324dfb22edd7a5ac3c0c40305211952808b6c01;hb=96cea94ad258be262ecf15b33d13cf775e59720d;hpb=5989dde3459b2ccd304f89e3e875136e5608b8ff diff --git a/src/stdlib/wcstoull.c b/src/stdlib/wcstoull.c index e324dfb2..48c557db 100644 --- a/src/stdlib/wcstoull.c +++ b/src/stdlib/wcstoull.c @@ -6,8 +6,11 @@ unsigned long long wcstoull(const wchar_t *s, wchar_t **p, int base) { - uintmax_t x = wcstoumax(s, p, base); - if (x > ULLONG_MAX) { + intmax_t x; + if (sizeof(intmax_t) == sizeof(long long)) + return wcstoumax(s, p, base); + x = wcstoimax(s, p, base); + if (-x > ULLONG_MAX || x > ULLONG_MAX) { errno = ERANGE; return ULLONG_MAX; }