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