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