[PATCH] itoa

Corinna Vinschen vinschen@redhat.com
Mon Dec 8 12:00:00 GMT 2014


On Dec  7 17:45, Freddie Chopin wrote:
> 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).

Hmm.  The code of both functions is rather shirt.  How much would
you actually save, code-wise?


Corinna

-- 
Corinna Vinschen
Cygwin Maintainer
Red Hat
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/newlib/attachments/20141208/f93dc2d6/attachment.sig>


More information about the Newlib mailing list