From: Denys Vlasenko <vda.linux@googlemail.com>
To: Michal Nazarewicz <mina86@mina86.com>
Cc: linux-kernel@vger.kernel.org, m.nazarewicz@samsung.com,
"Douglas W. Jones" <jones@cs.uiowa.edu>,
Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH 2/3] lib: vsprintf: optimised put_dec() for 32-bit machines
Date: Fri, 6 Aug 2010 09:35:26 +0200 [thread overview]
Message-ID: <201008060935.26989.vda.linux@googlemail.com> (raw)
In-Reply-To: <87eiec9q1w.fsf@erwin.mina86.com>
On Friday 06 August 2010 09:08, Michal Nazarewicz wrote:
> >> +static noinline_for_stack
> >> +char *put_dec(char *buf, unsigned long long n)
> >> +{
> >> + uint32_t d3, d2, d1, q;
> >> +
> >> + if (!n) {
> >> + *buf++ = '0';
> >> + return buf;
> >> + }
> >> +
> >> + d1 = (n >> 16) & 0xFFFF;
> >> + d2 = (n >> 32) & 0xFFFF;
> >> + d3 = (n >> 48) & 0xFFFF;
> >
> > Are you assuming that sizeof(long long) == 8, always?
>
> Well... yes. C requires long long to be at least 64-bit and I don't
> see it being larger in any foreseeable feature.
"640k will be enough for everybody"?
> Wouldn't it be enough to put a static assert here?
I'd prefer the code which works with arbitrarily wide long long.
If needed, use
if (sizeof(long long) == 8)
64-bit code
else
generic code
--
vda
next prev parent reply other threads:[~2010-08-06 7:35 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-08-05 22:38 [PATCH 1/3] lib: vsprintf: optimised put_dec_trunc() and put_dec_full() Michal Nazarewicz
2010-08-05 22:38 ` [PATCH 2/3] lib: vsprintf: optimised put_dec() for 32-bit machines Michal Nazarewicz
2010-08-05 22:38 ` [PATCH 3/3] lib: vsprintf: added a put_dec() test and benchmark tool Michal Nazarewicz
2010-08-06 5:10 ` Denys Vlasenko
2010-08-06 8:34 ` Michał Nazarewicz
2010-08-06 15:57 ` Raja R Harinath
2010-08-06 19:26 ` Denys Vlasenko
2010-08-06 20:58 ` Michal Nazarewicz
2010-08-06 5:18 ` [PATCH 2/3] lib: vsprintf: optimised put_dec() for 32-bit machines Denys Vlasenko
2010-08-06 7:08 ` Michal Nazarewicz
2010-08-06 7:35 ` Denys Vlasenko [this message]
2010-08-06 8:54 ` Michał Nazarewicz
2010-08-06 3:58 ` [PATCH 1/3] lib: vsprintf: optimised put_dec_trunc() and put_dec_full() Denys Vlasenko
2010-08-06 6:56 ` Michal Nazarewicz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=201008060935.26989.vda.linux@googlemail.com \
--to=vda.linux@googlemail.com \
--cc=akpm@linux-foundation.org \
--cc=jones@cs.uiowa.edu \
--cc=linux-kernel@vger.kernel.org \
--cc=m.nazarewicz@samsung.com \
--cc=mina86@mina86.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox