2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS system libraries
4 * FILE: lib/msvcrt/stdlib/itoa.c
5 * PURPOSE: converts a integer to ascii
9 * 1998: Added ltoa Boudewijn Dekker
11 /* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
12 #include <msvcrt/errno.h>
13 #include <msvcrt/stdlib.h>
16 _itoa(int value, char *string, int radix)
25 if (radix > 36 || radix <= 1)
31 sign = (radix == 10 && value < 0);
36 while (v || tp == tmp)
47 string = (char *)malloc((tp-tmp)+sign+1);
59 _ltoa(long value, char *string, int radix)
68 if (radix > 36 || radix <= 1)
74 sign = (radix == 10 && value < 0);
78 v = (unsigned long)value;
79 while (v || tp == tmp)
90 string = (char *)malloc((tp-tmp)+sign+1);
102 _ultoa(unsigned long value, char *string, int radix)
107 unsigned long v = value;
110 if (radix > 36 || radix <= 1)
116 while (v || tp == tmp)
123 *tp++ = i + 'a' - 10;
127 string = (char *)malloc((tp-tmp)+1);
137 _i64toa(__int64 value, char *string, int radix)
146 if (radix > 36 || radix <= 1)
152 sign = (radix == 10 && value < 0);
157 while (v || tp == tmp)
164 *tp++ = i + 'a' - 10;
168 string = (char *)malloc((tp-tmp)+sign+1);
180 _ui64toa(unsigned __int64 value, char *string, int radix)
185 unsigned long v = value;
188 if (radix > 36 || radix <= 1)
194 while (v || tp == tmp)
201 *tp++ = i + 'a' - 10;
205 string = (char *)malloc((tp-tmp)+1);