LibC: Implement strto{u,i}max()

This commit is contained in:
Bananymous 2024-08-05 00:53:27 +03:00
parent 5dce4e6aea
commit 3651306f57
2 changed files with 15 additions and 0 deletions

View File

@ -5,6 +5,7 @@ set(LIBC_SOURCES
dirent.cpp dirent.cpp
fcntl.cpp fcntl.cpp
grp.cpp grp.cpp
inttypes.cpp
locale.cpp locale.cpp
malloc.cpp malloc.cpp
math.cpp math.cpp

View File

@ -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);
}