[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Pine.LNX.4.64.0706151427370.12949@localhost.localdomain>
Date: Fri, 15 Jun 2007 14:28:16 -0400 (EDT)
From: "Robert P. J. Day" <rpjday@...dspring.com>
To: "H. Peter Anvin" <hpa@...or.com>
cc: Vegard Nossum <vegard.nossum@...il.com>,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] Optimize is_power_of_2().
On Fri, 15 Jun 2007, H. Peter Anvin wrote:
> Vegard Nossum wrote:
> > From: Vegard Nossum <vegard@...tkore.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
========================================================================
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists