Sprinkle cdecl declarations liberally all around to make a bunch of the base componen...
[reactos.git] / reactos / lib / sdk / crt / string / atoi64.c
1 /*
2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS system libraries
4 * FILE: lib/crt/??????
5 * PURPOSE: Unknown
6 * PROGRAMER: Unknown
7 * UPDATE HISTORY:
8 * 25/11/05: Added license header
9 */
10
11 #include <precomp.h>
12
13 /*
14 * @implemented
15 */
16 __int64
17 CDECL
18 _atoi64(const char *nptr)
19 {
20 char *s = (char *)nptr;
21 __int64 acc = 0;
22 int neg = 0;
23
24 if (nptr == NULL)
25 return 0;
26
27 while(isspace((int)*s))
28 s++;
29 if (*s == '-')
30 {
31 neg = 1;
32 s++;
33 }
34 else if (*s == '+')
35 s++;
36
37 while (isdigit((int)*s))
38 {
39 acc = 10 * acc + ((int)*s - '0');
40 s++;
41 }
42
43 if (neg)
44 acc *= -1;
45 return acc;
46 }