This is the mail archive of the
ecos-patches@sourceware.org
mailing list for the eCos project.
Re: [PATCH] Speed-up decimal formatting of integers.
- From: Andrew Lunn <andrew at lunn dot ch>
- To: Sergei Organov <osv at javad dot com>
- Cc: ecos-patches at ecos dot sourceware dot org
- Date: Thu, 1 Mar 2007 00:02:20 +0100
- Subject: Re: [PATCH] Speed-up decimal formatting of integers.
- References: <878xfcecu0.fsf@javad.com>
On Mon, Feb 05, 2007 at 08:25:27PM +0300, Sergei Organov wrote:
>
> Current vfnprintf() implementation always uses long long arithmetic when
> formatting integers. While this is acceptable for formatting in
> hexadecimal and octal, for formatting in decimal it results in using
> of generic long long integer division function (GCC built-in) that is
> very time consuming, especially for targets without hardware integer
> division.
>
> In addition, changing the type of division from "long long" to "long"
> allows GCC to replace the division by 10 by the special fast inline
> algorithm that avoids using of generic division routine entirely.
>
> The attached patch gets rid of long long division, unless long long
> argument is to be printed.
>
Thanks
Committed,
Andrew