From: Andrew Morton <akpm@linux-foundation.org>
To: Akinobu Mita <akinobu.mita@gmail.com>
Cc: linux-kernel@vger.kernel.org,
Mikulas Patocka <mikulas@artax.karlin.mff.cuni.cz>,
Al Viro <viro@zeniv.linux.org.uk>
Subject: Re: [PATCH] hpfs: Use hweight32
Date: Fri, 13 Nov 2009 15:32:55 -0800 [thread overview]
Message-ID: <20091113153255.9726be89.akpm@linux-foundation.org> (raw)
In-Reply-To: <1258096028-13426-1-git-send-email-akinobu.mita@gmail.com>
On Fri, 13 Nov 2009 16:07:08 +0900
Akinobu Mita <akinobu.mita@gmail.com> wrote:
> Use hweight32 instead of counting for each bit
>
> Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
> Cc: Mikulas Patocka <mikulas@artax.karlin.mff.cuni.cz>
> Cc: Al Viro <viro@zeniv.linux.org.uk>
> ---
> fs/hpfs/super.c | 7 ++-----
> 1 files changed, 2 insertions(+), 5 deletions(-)
>
> diff --git a/fs/hpfs/super.c b/fs/hpfs/super.c
> index f2feaa0..cf6fe4a 100644
> --- a/fs/hpfs/super.c
> +++ b/fs/hpfs/super.c
> @@ -119,11 +119,8 @@ unsigned hpfs_count_one_bitmap(struct super_block *s, secno secno)
> unsigned i, count;
> if (!(bits = hpfs_map_4sectors(s, secno, &qbh, 4))) return 0;
> count = 0;
> - for (i = 0; i < 2048 / sizeof(unsigned); i++) {
> - unsigned b;
> - if (!bits[i]) continue;
> - for (b = bits[i]; b; b>>=1) count += b & 1;
> - }
> + for (i = 0; i < 2048 / sizeof(unsigned); i++)
> + count += hweight32(bits[i]);
> hpfs_brelse4(&qbh);
> return count;
Could actualy use bitmap_weight() here.
It's a bit naughty, because bitmap_weight() operates on long*'s, but it
will work OK.
Shrug.
next prev parent reply other threads:[~2009-11-13 23:32 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-11-13 7:07 [PATCH] hpfs: Use hweight32 Akinobu Mita
2009-11-13 23:32 ` Andrew Morton [this message]
2009-11-15 7:16 ` Mikulas Patocka
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=20091113153255.9726be89.akpm@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=akinobu.mita@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mikulas@artax.karlin.mff.cuni.cz \
--cc=viro@zeniv.linux.org.uk \
/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