CVS: msp430-libc/src/stdlib itoa.c,1.1,1.2

Chris Takahashi <[email protected]>
Newsgroups gmane.comp.hardware.texas-instruments.msp430.gcc.cvs
Message-ID <[email protected]>
Update of /cvsroot/mspgcc/msp430-libc/src/stdlib
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23130/src/stdlib

Modified Files:
	itoa.c 
Log Message:
itoa() now displays 0 properly.  Added ltoa, utoa, and ultoa

Index: itoa.c
===================================================================
RCS file: /cvsroot/mspgcc/msp430-libc/src/stdlib/itoa.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -w -d -r1.1 -r1.2
--- itoa.c	2 Jul 2004 19:09:31 -0000	1.1
+++ itoa.c	23 Aug 2004 20:20:54 -0000	1.2
@@ -22,14 +22,14 @@
 	}
 	
 	//construct a backward string of the number.
-	while ((unsigned int)num > 0) {
+	do {
 		digit = (unsigned int)num % radix;
 		if (digit < 10) 
 			temp[temp_loc++] = digit + '0';
 		else
 			temp[temp_loc++] = digit - 10 + 'A';
 		((unsigned int)num) /= radix;
-	}
+	} while ((unsigned int)num > 0);
 
 	//now add the sign for radix 10
 	if (radix == 10 && sign) {
@@ -47,3 +47,4 @@
 
 	return str;
 }
+



-------------------------------------------------------
SF.Net email is sponsored by Shop4tech.com-Lowest price on Blank Media
100pk Sonic DVD-R 4x for only $29 -100pk Sonic DVD+R for only $33
Save 50% off Retail on Ink & Toner - Free Shipping and Free Gift.
http://www.shop4tech.com/z/Inkjet_Cartridges/9_108_r285
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.