forked from Bananymous/banan-os
LibC: Implement strtou{l,ll}
This commit is contained in:
parent
a5a041e637
commit
1b24c4f279
|
@ -113,7 +113,7 @@ static T strtoT(const char* str, char** endp, int base)
|
||||||
|
|
||||||
// limits of type T
|
// limits of type T
|
||||||
constexpr T max_val = BAN::numeric_limits<T>::max();
|
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;
|
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);
|
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)
|
char* getenv(const char* name)
|
||||||
{
|
{
|
||||||
if (environ == nullptr)
|
if (environ == nullptr)
|
||||||
|
|
Loading…
Reference in New Issue