Re: [PATCH V2 mmots] fs/hfsplus/wrapper.c: replace shift loop by fls

From: Joe Perches
Date: Mon May 19 2014 - 19:50:16 EST


On Mon, 2014-05-19 at 16:40 -0700, Andrew Morton wrote:
> On Mon, 19 May 2014 16:22:28 -0700 Joe Perches <joe@xxxxxxxxxxx> wrote:
>
> > On Mon, 2014-05-19 at 16:09 -0700, Andrew Morton wrote:
> > > On Fri, 16 May 2014 22:38:15 +0200 Fabian Frederick <fabf@xxxxxxxxx> wrote:
> > > > Replace while blocksize;shift by fls -1
> > []
> > > fls() always makes my brain hurt. ilog() is nicer?
> > Maybe take an aspirin?
> > ilog2(n) is effectively fls(n) - 1
> Precisely. ilog2() means "integer log 2". Whereas fls() is some weird
> low-level bit-scanning thing.

<shrug> find-last[bit]-set is pretty obvious to me.
ilog2(n) makes me think just a little more.

> What we want at this callsite is "integer log 2". So use it.

Same thing. Same ratio of use too.

$ git grep -w fls | wc -l
457
$ git grep -w ilog2 | wc -l
391


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/