diff options
Diffstat (limited to 'userland/libc/stdlib/strtoll.c')
-rw-r--r-- | userland/libc/stdlib/strtoll.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/userland/libc/stdlib/strtoll.c b/userland/libc/stdlib/strtoll.c index 486f91d..d1eacde 100644 --- a/userland/libc/stdlib/strtoll.c +++ b/userland/libc/stdlib/strtoll.c @@ -28,8 +28,18 @@ long long strtoll(const char *str, char **restrict endptr, int base) { } if (0 == base) { - // FIXME - assert(0); + char prefix = *str; + if ('0' == prefix) { + str++; + if ('x' == tolower(*str)) { + str++; + base = 16; + } else { + base = 8; + } + } else { + base = 10; + } } if (2 <= base && 36 >= base) { |