[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <200902170940.59703.rusty@rustcorp.com.au>
Date: Tue, 17 Feb 2009 09:40:59 +1030
From: Rusty Russell <rusty@...tcorp.com.au>
To: Benny Halevy <bhalevy@...asas.com>
Cc: linux-kernel@...r.kernel.org
Subject: Re: [PATCH] bitmap: Cleanup find_last_bit
On Monday 16 February 2009 23:28:40 Benny Halevy wrote:
> Fix cut & paste error in header comment.
> Simplify implementation a bit.
Hi Benny,
Nice catch! But I disagree with one change:
> /* Partial final word? */
> - if (size & (BITS_PER_LONG-1)) {
> - tmp = (addr[words] & (~0UL >> (BITS_PER_LONG
> - - (size & (BITS_PER_LONG-1)))));
> + tmp = size & (BITS_PER_LONG-1);
> + if (tmp) {
> + tmp = addr[words] & (~0UL >> (BITS_PER_LONG - tmp));
> if (tmp)
> goto found;
> }
The overloading of tmp to the remainder size here is not really a cleanup: it
makes it into a dual-use var. I know it's called tmp, but that's a sign of
poor code too :)
I'd prefer a new final_bits var: gcc will almost certainly just slap it in
a register anyway, but it's clearer.
tmp could then be called something like... word?
Thanks!
Rusty.
--
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