This is the mail archive of the
newlib@sourceware.org
mailing list for the newlib project.
Re: [PATCH] itoa
- From: Freddie Chopin <freddie_chopin at op dot pl>
- To: newlib at sourceware dot org
- Date: Sun, 07 Dec 2014 17:45:46 +0100
- Subject: Re: [PATCH] itoa
- Authentication-results: sourceware.org; auth=none
- References: <000001d01222$7f382b80$7da88280$ at beniston dot com>
On 12/07/2014 02:34 PM, Jon Beniston wrote:
Hi,
The attached patch adds support for the itoa and utoa functions, for
converting integers to strings.
This is a function that is supported on other platforms, and useful on
embedded systems where sprintf is quite large and doesn't support binary.
Cheers,
Jon
Good idea to add that (; I have a _LOT_ of ideas on using them in newlib
instead of standard functions (;
Anyway - I think itoa() should be implemented as a wrapper for utoa with
more or less this operations:
- check if base == 10 and value less than 0
- - if yes, add '-' character to the string and move the pointer one
character further and negate the value
- do the cast to unsigned
- call utoa() (with the modified string pointer).
Regards,
FCh