ratio submodule
This commit is contained in:
6
libbozo/src/stdlib/atoi.c
Normal file
6
libbozo/src/stdlib/atoi.c
Normal file
@ -0,0 +1,6 @@
|
||||
#include "../../headers/stdlib.h"
|
||||
|
||||
int atoi(const char *str)
|
||||
{
|
||||
return atoll(str);
|
||||
}
|
6
libbozo/src/stdlib/atol.c
Normal file
6
libbozo/src/stdlib/atol.c
Normal file
@ -0,0 +1,6 @@
|
||||
#include "../../headers/stdlib.h"
|
||||
|
||||
long atol(const char *str)
|
||||
{
|
||||
return atoll(str);
|
||||
}
|
13
libbozo/src/stdlib/atoll.c
Normal file
13
libbozo/src/stdlib/atoll.c
Normal file
@ -0,0 +1,13 @@
|
||||
#include "../../headers/ctype.h"
|
||||
|
||||
long long atoll(const char *str)
|
||||
{
|
||||
const char *start = str;
|
||||
long long ret = 0;
|
||||
|
||||
while (*start != '\0') {
|
||||
if (isdigit(*str))
|
||||
ret = ret * 10 + *str - '0';
|
||||
}
|
||||
return ret;
|
||||
}
|
Reference in New Issue
Block a user