LibC: Implement strtou{l,ll}

This commit is contained in:
Bananymous 2024-02-15 12:25:56 +02:00
parent a5a041e637
commit 1b24c4f279
1 changed files with 11 additions and 1 deletions

View File

@ -113,7 +113,7 @@ static T strtoT(const char* str, char** endp, int base)
// limits of type T
constexpr T max_val = BAN::numeric_limits<T>::max();
constexpr T min_val = -max_val - 1;
constexpr T min_val = BAN::is_signed_v<T> ? -max_val - 1 : 0;
bool overflow = false;
@ -191,6 +191,16 @@ long long strtoll(const char* __restrict str, char** __restrict endp, int base)
return strtoT<long long>(str, endp, base);
}
unsigned long strtoul(const char* __restrict str, char** __restrict endp, int base)
{
return strtoT<unsigned long>(str, endp, base);
}
unsigned long long strtoull(const char* __restrict str, char** __restrict endp, int base)
{
return strtoT<unsigned long long>(str, endp, base);
}
char* getenv(const char* name)
{
if (environ == nullptr)