- Start rosapps rearrange and cleanup process.
[reactos.git] / rosapps / applications / sysutils / regexpl / CrtSupplement.c
1 /* $Id$
2 *
3 * Written by EA because ReactOS hasn't yet _ui64toa()
4 * (it's in msvcrt.dll, and not in crtdll.dll).
5 */
6
7 #include <stdlib.h>
8
9 static
10 char DigitMap [] = "0123456789abcdefghijklmnopqrstuvwxyz";
11
12 char *
13 _ui64toa (
14 unsigned __int64 value,
15 char * string,
16 int radix
17 )
18 {
19 int reminder = 0;
20 char buffer [17];
21 char * w = buffer;
22 int len = 0;
23 int i = 0;
24
25 /* Check the radix is valid */
26 if ((2 > radix) || (36 < radix))
27 {
28 return string;
29 }
30 /* Convert the int64 to a string */
31 do {
32 reminder = (int) (value % (__int64) radix);
33 *(w ++) = DigitMap [reminder];
34 value /= (__int64) radix;
35 ++ len;
36
37 } while ((__int64) value > 0);
38 /* Reverse the string */
39 while (i < len)
40 {
41 string [i ++] = *(-- w);
42 }
43 string [len] = '\0';
44
45 return string;
46 }
47
48
49
50 /* EOF */