[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <201012021937.44368.br1@einfach.org>
Date: Thu, 2 Dec 2010 19:37:44 +0900
From: Bruno Randolf <br1@...fach.org>
To: Johannes Berg <johannes@...solutions.net>
Cc: linville@...driver.com, randy.dunlap@...cle.com,
peterz@...radead.org, blp@...stanford.edu,
linux-wireless@...r.kernel.org, linux-kernel@...r.kernel.org,
Lars_Ericsson@...ia.com, j@...fi, stefanr@...6.in-berlin.de,
kosaki.motohiro@...fujitsu.com, akpm@...ux-foundation.org,
kevin.granade@...il.com
Subject: Re: [PATCH 2/3] lib: Improve EWMA efficiency by using bitshifts
On Thu December 2 2010 19:20:22 Johannes Berg wrote:
> On Thu, 2010-12-02 at 19:12 +0900, Bruno Randolf wrote:
> > + /* get bitshift for weight */
> > + for (n = 0; !(weight & 1); n++)
> > + weight = weight >> 1;
> > + WARN_ON(weight > 1 || n < 1);
>
> I'm sure there's something like log2() (and is_power_of_2() for the
> warning) in the kernel already -- no need to reimplement it...
Ah, thanks for that! Will resend an improved version.
bruno
--
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