mirror of
https://git.planet-casio.com/Vhex-Kernel-Core/fxlibc.git
synced 2024-12-28 04:23:38 +01:00
stdlib: add atoi, atol and atoll
This commit is contained in:
parent
06f975f75c
commit
ade01b532e
6 changed files with 33 additions and 1 deletions
|
@ -99,6 +99,9 @@ set(SOURCES
|
|||
src/libc/stdio/printf.c
|
||||
# stdlib
|
||||
src/libc/stdlib/abs.c
|
||||
src/libc/stdlib/atoi.c
|
||||
src/libc/stdlib/atol.c
|
||||
src/libc/stdlib/atoll.c
|
||||
src/libc/stdlib/calloc.c
|
||||
src/libc/stdlib/div.c
|
||||
src/libc/stdlib/labs.c
|
||||
|
|
2
STATUS
2
STATUS
|
@ -98,7 +98,7 @@ DONE: Function/symbol/macro is defined, builds, links, and is tested
|
|||
|
||||
7.20 <stdlib.h>
|
||||
7.20.1.1 atof: TODO
|
||||
7.20.1.2 atoi, atol, atoll: TODO
|
||||
7.20.1.2 atoi, atol, atoll: DONE
|
||||
7.20.1.3 strtod, strtof, strtold: TODO
|
||||
7.20.1.4 strtol, strtoul, strtoll, strtoull: DONE
|
||||
7.20.2 Pseudo-random sequence generation functions: TODO
|
||||
|
|
|
@ -63,6 +63,17 @@ div_t div(int __num, int __denom);
|
|||
ldiv_t ldiv(long int __num, long int __denom);
|
||||
lldiv_t lldiv(long long int __num, long long int __denom);
|
||||
|
||||
/* Simplified numeric conversion functions. */
|
||||
|
||||
/* ASCII to int. */
|
||||
extern int atoi(char const *__ptr);
|
||||
|
||||
/* ASCII to long int. */
|
||||
extern long int atol(char const *__ptr);
|
||||
|
||||
/* ASCII to long long int. */
|
||||
extern long long int atoll(char const *__ptr);
|
||||
|
||||
/* Numeric conversion functions. */
|
||||
|
||||
/* Parse a long int from a string. */
|
||||
|
|
6
src/libc/stdlib/atoi.c
Normal file
6
src/libc/stdlib/atoi.c
Normal file
|
@ -0,0 +1,6 @@
|
|||
#include <stdlib.h>
|
||||
|
||||
int atoi(char const *ptr)
|
||||
{
|
||||
return (int)strtol(ptr, NULL, 10);
|
||||
}
|
6
src/libc/stdlib/atol.c
Normal file
6
src/libc/stdlib/atol.c
Normal file
|
@ -0,0 +1,6 @@
|
|||
#include <stdlib.h>
|
||||
|
||||
long int atol(char const *ptr)
|
||||
{
|
||||
return strtol(ptr, NULL, 10);
|
||||
}
|
6
src/libc/stdlib/atoll.c
Normal file
6
src/libc/stdlib/atoll.c
Normal file
|
@ -0,0 +1,6 @@
|
|||
#include <stdlib.h>
|
||||
|
||||
long long int atoll(char const *ptr)
|
||||
{
|
||||
return strtoll(ptr, NULL, 10);
|
||||
}
|
Loading…
Reference in a new issue