diff options
author | David E. O'Brien <obrien@FreeBSD.org> | 2001-02-27 13:33:07 +0000 |
---|---|---|
committer | David E. O'Brien <obrien@FreeBSD.org> | 2001-02-27 13:33:07 +0000 |
commit | 4c0440cb8652801c1c3750a474f7ddbb17897cdf (patch) | |
tree | eb116378d50e15fc35d1602c0784e9b8bd920e36 /lib/libc/stdlib/strtoull.c | |
parent | 1b0dabf0c01e7ada145b752392609ed5438971df (diff) |
Notes
Diffstat (limited to 'lib/libc/stdlib/strtoull.c')
-rw-r--r-- | lib/libc/stdlib/strtoull.c | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/lib/libc/stdlib/strtoull.c b/lib/libc/stdlib/strtoull.c index 7656a3c53b148..3e7c943fc7f1a 100644 --- a/lib/libc/stdlib/strtoull.c +++ b/lib/libc/stdlib/strtoull.c @@ -35,6 +35,11 @@ static char sccsid[] = "@(#)strtouq.c 8.1 (Berkeley) 6/4/93"; #endif /* LIBC_SCCS and not lint */ +#ifndef lint +static const char rcsid[] = + "$FreeBSD$"; +#endif + #include <sys/types.h> #include <limits.h> @@ -43,21 +48,21 @@ static char sccsid[] = "@(#)strtouq.c 8.1 (Berkeley) 6/4/93"; #include <stdlib.h> /* - * Convert a string to an unsigned quad integer. + * Convert a string to an unsigned long long integer. * * Ignores `locale' stuff. Assumes that the upper and lower case * alphabets and digits are each contiguous. */ -u_quad_t -strtouq(nptr, endptr, base) +unsigned long long +strtoull(nptr, endptr, base) const char *nptr; char **endptr; register int base; { register const char *s = nptr; - register u_quad_t acc; + register unsigned long long acc; register unsigned char c; - register u_quad_t qbase, cutoff; + register unsigned long long qbase, cutoff; register int neg, any, cutlim; /* @@ -84,8 +89,8 @@ strtouq(nptr, endptr, base) if (base == 0) base = c == '0' ? 8 : 10; qbase = (unsigned)base; - cutoff = (u_quad_t)UQUAD_MAX / qbase; - cutlim = (u_quad_t)UQUAD_MAX % qbase; + cutoff = (unsigned long long)ULLONG_MAX / qbase; + cutlim = (unsigned long long)ULLONG_MAX % qbase; for (acc = 0, any = 0;; c = *s++) { if (!isascii(c)) break; @@ -106,7 +111,7 @@ strtouq(nptr, endptr, base) } } if (any < 0) { - acc = UQUAD_MAX; + acc = ULLONG_MAX; errno = ERANGE; } else if (neg) acc = -acc; |