Lines Matching +full:10 +full:base
78 ret *= 10;
191 /* Converts the unsigned 64bit integer <in> to base <base> ascii into
206 * recip = p2 / base - e1; // With e1 < base.
208 * = base / in - (e1 * in + e2) / p2;
209 * > base / in - (e1 * p2 + p2) / p2;
210 * = base / in - ((e1 + 1) * p2) / p2;
211 * > base / in - base;
212 * So the maximum error is less than 'base'.
213 * Hence the largest possible digit is '2 * base - 1'.
214 * For base 10 e1 is 6 and you can get digits of 15 (eg from 2**64-1).
215 * Error e1 is largest for a base that is a factor of 2**64+1, the smallest is 274177
216 * and converting 2**42-1 in base 274177 does generate a digit of 274177+274175.
222 #define _NOLIBC_U64TOA_RECIP(base) ((base) & 1 ? ~0ull / (base) : (1ull << 63) / ((base) / 2))
224 int _nolibc_u64toa_base(uint64_t in, char *buffer, unsigned int base, uint64_t recip)
241 dig = in - q * base;
243 if (dig >= base) {
244 dig -= base;
248 dig += 'a' - '0' - 10;
295 return _nolibc_u64toa_base(in, buffer, 10, _NOLIBC_U64TOA_RECIP(10));
390 return _nolibc_u64toa_base(in, buffer, 10, _NOLIBC_U64TOA_RECIP(10));
435 uintmax_t __strtox(const char *nptr, char **endptr, int base, intmax_t lower_limit, uintmax_t upper_limit)
442 if (base < 0 || base > 36) {
462 if ((base == 0 || base == 16) &&
464 base = 16;
466 } else if (base == 0 && strncmp(nptr, "0", 1) == 0) {
467 base = 8;
469 } else if (base == 0) {
470 base = 10;
479 c = c - 'a' + 10;
481 c = c - 'A' + 10;
485 if (c >= base)
490 val *= base;
508 long strtol(const char *nptr, char **endptr, int base)
510 return __strtox(nptr, endptr, base, LONG_MIN, LONG_MAX);
514 unsigned long strtoul(const char *nptr, char **endptr, int base)
516 return __strtox(nptr, endptr, base, 0, ULONG_MAX);
520 long long strtoll(const char *nptr, char **endptr, int base)
522 return __strtox(nptr, endptr, base, LLONG_MIN, LLONG_MAX);
526 unsigned long long strtoull(const char *nptr, char **endptr, int base)
528 return __strtox(nptr, endptr, base, 0, ULLONG_MAX);
532 intmax_t strtoimax(const char *nptr, char **endptr, int base)
534 return __strtox(nptr, endptr, base, INTMAX_MIN, INTMAX_MAX);
538 uintmax_t strtoumax(const char *nptr, char **endptr, int base)
540 return __strtox(nptr, endptr, base, 0, UINTMAX_MAX);