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