diff --git a/libc/include/inttypes.h b/libc/include/inttypes.h index ed38207a..76b02bda 100644 --- a/libc/include/inttypes.h +++ b/libc/include/inttypes.h @@ -200,8 +200,8 @@ __BEGIN_DECLS intmax_t imaxabs(intmax_t); /* TODO: imaxdiv */ -/* TODO: strtoimax */ -/* TODO: strtoumax */ +intmax_t strtoimax(const char* __restrict, char** __restrict, int); +uintmax_t strtoumax(const char* __restrict, char** __restrict, int); /* TODO: wcstoimax */ /* TODO: wcstoumax */ diff --git a/libc/stdlib/integer.cpp b/libc/stdlib/integer.cpp index cb272442..221bbd61 100644 --- a/libc/stdlib/integer.cpp +++ b/libc/stdlib/integer.cpp @@ -1,6 +1,6 @@ /******************************************************************************* - Copyright(C) Jonas 'Sortie' Termansen 2011. + Copyright(C) Jonas 'Sortie' Termansen 2011, 2013. This file is part of the Sortix C Library. @@ -23,6 +23,7 @@ *******************************************************************************/ #include +#include #include #include @@ -79,6 +80,11 @@ extern "C" long long strtoll(const char* str, char** endptr, int base) return ParseInteger(str, endptr, base); } +extern "C" intmax_t strtoimax(const char* str, char** endptr, int base) +{ + return ParseInteger(str, endptr, base); +} + extern "C" unsigned long strtoul(const char* str, char** endptr, int base) { return ParseInteger(str, endptr, base); @@ -88,3 +94,8 @@ extern "C" unsigned long long strtoull(const char* str, char** endptr, int base) { return ParseInteger(str, endptr, base); } + +extern "C" uintmax_t strtoumax(const char* str, char** endptr, int base) +{ + return ParseInteger(str, endptr, base); +}