:pserver:cvsanon@mok.lvcm.com:/CVS/ReactOS reactos
[reactos.git] / lib / msvcrt / stdlib / atoi64.c
1
2 #include <msvcrt/ctype.h>
3 #include <msvcrt/stdlib.h>
4
5 __int64
6 _atoi64(const char *nptr)
7 {
8   char *s = (char *)nptr;
9   __int64 acc = 0;
10   int neg = 0;
11
12   while(isspace((int)*s))
13     s++;
14   if (*s == '-')
15     {
16       neg = 1;
17       s++;
18     }
19   else if (*s == '+')
20     s++;
21
22   while (isdigit((int)*s))
23     {
24       acc = 10 * acc + ((int)*s - '0');
25       s++;
26     }
27
28   if (neg)
29     acc *= -1;
30   return acc;
31 }