2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS system libraries
4 * FILE: lib/crtdll/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 */
13 #include <msvcrt/errno.h>
14 #include <msvcrt/stdlib.h>
15 #include <msvcrt/internal/file.h>
21 * this function is now forwarded to NTDLL._itoa to reduce code duplication
24 char* _itoa(int value, char* string, int radix)
33 if (radix > 36 || radix <= 1)
39 sign = (radix == 10 && value < 0);
44 while (v || tp == tmp)
55 string = (char *)malloc((tp-tmp)+sign+1);
70 * this function is now forwarded to NTDLL._ltoa to reduce code duplication
73 char* _ltoa(long value, char* string, int radix)
82 if (radix > 36 || radix <= 1)
88 sign = (radix == 10 && value < 0);
92 v = (unsigned long)value;
93 while (v || tp == tmp)
100 *tp++ = i + 'a' - 10;
104 string = (char *)malloc((tp-tmp)+sign+1);
119 * this function is now forwarded to NTDLL._ultoa to reduce code duplication
122 char* _ultoa(unsigned long value, char* string, int radix)
127 unsigned long v = value;
130 if (radix > 36 || radix <= 1)
136 while (v || tp == tmp)
143 *tp++ = i + 'a' - 10;
147 string = (char *)malloc((tp-tmp)+1);