LibC: Implement strto{u,i}max()
This commit is contained in:
parent
5dce4e6aea
commit
3651306f57
|
@ -5,6 +5,7 @@ set(LIBC_SOURCES
|
|||
dirent.cpp
|
||||
fcntl.cpp
|
||||
grp.cpp
|
||||
inttypes.cpp
|
||||
locale.cpp
|
||||
malloc.cpp
|
||||
math.cpp
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
#include <inttypes.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
intmax_t strtoimax(const char* __restrict nptr, char** __restrict endptr, int base)
|
||||
{
|
||||
static_assert(sizeof(intmax_t) == sizeof(long long));
|
||||
return strtoll(nptr, endptr, base);
|
||||
}
|
||||
|
||||
uintmax_t strtoumax(const char* __restrict nptr, char** __restrict endptr, int base)
|
||||
{
|
||||
static_assert(sizeof(uintmax_t) == sizeof(unsigned long long));
|
||||
return strtoull(nptr, endptr, base);
|
||||
}
|
Loading…
Reference in New Issue