From: "Robert P. J. Day" <rpjday@mindspring.com>
To: "H. Peter Anvin" <hpa@zytor.com>
Cc: Vegard Nossum <vegard.nossum@gmail.com>, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Optimize is_power_of_2().
Date: Fri, 15 Jun 2007 14:28:16 -0400 (EDT) [thread overview]
Message-ID: <Pine.LNX.4.64.0706151427370.12949@localhost.localdomain> (raw)
In-Reply-To: <4672D89D.7010801@zytor.com>
On Fri, 15 Jun 2007, H. Peter Anvin wrote:
> Vegard Nossum wrote:
> > From: Vegard Nossum <vegard@peltkore.net>
> > Date: Fri, 15 Jun 2007 18:35:49 +0200
> > Subject: [PATCH] Optimize is_power_of_2().
> >
> > Rationale: Removes one conditional branch and reduces icache
> > footprint. Proof: If n is false, the product of n and any value is
> > false. If n is true, the truth of (n * x) is the truth of x.
>
> You realize that on a lot of platforms, multiplication is done by an
> out-of-line subroutine, and that even on those that aren't, it's
> generally a long-pipeline operation, right?
i was *just* about to mention somthing of the sort, but probably not
as succinctly.
rday
--
========================================================================
Robert P. J. Day
Linux Consulting, Training and Annoying Kernel Pedantry
Waterloo, Ontario, CANADA
http://fsdev.net/wiki/index.php?title=Main_Page
========================================================================
next prev parent reply other threads:[~2007-06-15 18:30 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-06-15 16:56 Vegard Nossum
2007-06-15 18:21 ` H. Peter Anvin
2007-06-15 18:28 ` Robert P. J. Day [this message]
2007-06-15 20:26 ` H. Peter Anvin
2007-06-15 19:47 ` Jan Engelhardt
2007-06-15 19:54 ` David M. Lloyd
2007-06-15 19:57 ` David M. Lloyd
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=Pine.LNX.4.64.0706151427370.12949@localhost.localdomain \
--to=rpjday@mindspring.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=vegard.nossum@gmail.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
all inboxes | Powered by JetHome®