diff --git a/inc/stdlib.h b/inc/stdlib.h index 53c7f75..807e321 100644 --- a/inc/stdlib.h +++ b/inc/stdlib.h @@ -27,6 +27,9 @@ uint64_t strtoul(const char *str, char **endptr, int32_t base); int64_t strtol(const char *str, char **endptr, int32_t base); +int32_t atoi(const char* str); +int64_t atol(const char* str); + float strtof(const char *str, char **endptr); void abort(void); diff --git a/src/stdlib.c b/src/stdlib.c index f0053e2..35d33df 100644 --- a/src/stdlib.c +++ b/src/stdlib.c @@ -276,6 +276,21 @@ +int32_t atoi(const char* str) +{ + char* endptr; + return (int32_t)strtol(str, &endptr, 10); +} + + +int64_t atol(const char* str) +{ + char* endptr; + return strtol(str, &endptr, 10); +} + + + void abort(void) { rtlibc_abort_handler();