David Gibson wrote: >>+/* Not currently supported: leading whitespace, sign, 0x prefix, zero base */ >>+unsigned long long int strtoull(const char *ptr, char **end, int base) >>+{ >>+ unsigned long long ret = 0; >>+ >>+ while (*ptr) { >>+ int digit; >>+ >>+ if (*ptr >= '0' && *ptr <= '9') >>+ digit = *ptr - '0'; >>+ else if (*ptr >= 'A' && *ptr <= 'Z') >>+ digit = *ptr - 'A' + 10; >>+ else if (*ptr >= 'a' && *ptr <= 'z') >>+ digit = *ptr - 'a' + 10; >>+ else >>+ break; > > > Hrm... I note this has no sort of error checking if the string has > digits which don't fit in the given base.
Oops. I'll fix that. -Scott _______________________________________________ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev