PatchworkOS
19e446b
A non-POSIX operating system.
Theme:
Default
Round
Robot
Loading...
Searching...
No Matches
atoll.c
Go to the documentation of this file.
1
#include <
ctype.h
>
2
#include <
stdbool.h
>
3
#include <
stdlib.h
>
4
#include <
string.h
>
5
6
#include "
common/digits.h
"
7
8
long
long
int
atoll
(
const
char
* nptr)
9
{
10
long
long
int
result = 0;
11
bool
isNegative =
false
;
12
13
while
(
isspace
((
unsigned
char
)*nptr))
14
{
15
nptr++;
16
}
17
18
if
(*nptr ==
'+'
)
19
{
20
nptr++;
21
}
22
else
if
(*nptr ==
'-'
)
23
{
24
nptr++;
25
isNegative =
true
;
26
}
27
28
const
char
*
x
;
29
while
((
x
= (
const
char
*)
memchr
(
_digits
,
tolower
((
unsigned
char
)*(nptr++)), 10)) !=
NULL
)
30
{
31
result = result * 10 + (
x
-
_digits
);
32
}
33
34
return
isNegative ? -result : result;
35
}
atoll
long long int atoll(const char *nptr)
Definition
atoll.c:8
x
int64_t x
Definition
main.c:152
ctype.h
isspace
#define isspace(c)
Definition
ctype.h:30
tolower
#define tolower(c)
Definition
ctype.h:36
_digits
const char _digits[]
Definition
digits.c:3
digits.h
NULL
#define NULL
Pointer error value.
Definition
NULL.h:25
stdbool.h
stdlib.h
string.h
memchr
_PUBLIC void * memchr(const void *s, int c, size_t n)
Definition
memchr.c:3
src
libstd
functions
stdlib
atoll.c
Generated on Sat Jan 24 2026 10:59:25 for PatchworkOS by
1.9.8