diff --git a/libc/stdlib.cpp b/libc/stdlib.cpp index 1d4e7a35..d36f9cf2 100644 --- a/libc/stdlib.cpp +++ b/libc/stdlib.cpp @@ -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::max(); - constexpr T min_val = -max_val - 1; + constexpr T min_val = BAN::is_signed_v ? -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(str, endp, base); } +unsigned long strtoul(const char* __restrict str, char** __restrict endp, int base) +{ + return strtoT(str, endp, base); +} + +unsigned long long strtoull(const char* __restrict str, char** __restrict endp, int base) +{ + return strtoT(str, endp, base); +} + char* getenv(const char* name) { if (environ == nullptr)