From: Rusty Russell <rusty@rustcorp.com.au>
To: Benny Halevy <bhalevy@panasas.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] bitmap: Cleanup find_last_bit
Date: Tue, 17 Feb 2009 09:40:59 +1030 [thread overview]
Message-ID: <200902170940.59703.rusty@rustcorp.com.au> (raw)
In-Reply-To: <1234789120-31543-1-git-send-email-bhalevy@panasas.com>
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.
next prev parent reply other threads:[~2009-02-16 23:11 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-12-01 8:18 [PATCH 5/6] bitmap: find_last_bit() Rusty Russell
2009-02-16 12:58 ` [PATCH] bitmap: Cleanup find_last_bit Benny Halevy
2009-02-16 23:10 ` Rusty Russell [this message]
2009-02-17 4:44 ` Benny Halevy
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=200902170940.59703.rusty@rustcorp.com.au \
--to=rusty@rustcorp.com.au \
--cc=bhalevy@panasas.com \
--cc=linux-kernel@vger.kernel.org \
/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