- Define _CTYPE_DISABLE_MACROS for MSVC build.
[reactos.git] / reactos / lib / string / wtoi64.c
1 #include <string.h>
2 #include <ctype.h>
3
4
5 /*
6 * @implemented
7 */
8 __int64
9 _wtoi64 (const wchar_t *nptr)
10 {
11 int c;
12 __int64 value;
13 int sign;
14
15 while (iswctype((int)*nptr, _SPACE))
16 ++nptr;
17
18 c = (int)*nptr++;
19 sign = c;
20 if (c == L'-' || c == L'+')
21 c = (int)*nptr++;
22
23 value = 0;
24
25 while (iswctype(c, _DIGIT))
26 {
27 value = 10 * value + (c - L'0');
28 c = (int)*nptr++;
29 }
30
31 if (sign == L'-')
32 return -value;
33 else
34 return value;
35 }
36
37 /* EOF */