From: Arnd Bergmann <arnd@arndb.de>
To: Bob Copeland <me@bobcopeland.com>
Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH 5/7] omfs: add bitmap routines
Date: Fri, 28 Mar 2008 04:51:10 +0100 [thread overview]
Message-ID: <200803280451.11216.arnd@arndb.de> (raw)
In-Reply-To: <1206578760-9050-5-git-send-email-me@bobcopeland.com>
On Thursday 27 March 2008, Bob Copeland wrote:
> +static int nibblemap[] = {4, 3, 3, 2, 3, 2, 2, 1, 3, 2, 2, 1, 2, 1, 1, 0};
> +
> +unsigned long omfs_count_free(struct super_block *sb)
> +{
> + unsigned int i, j, count = 0;
> + unsigned char *map;
> + unsigned long sum = 0;
> + struct omfs_sb_info *sbi = OMFS_SB(sb);
> +
> + for (i = 0; i < sbi->s_imap_size; i++) {
> + map = (unsigned char *) sbi->s_imap[i];
> + for (j = 0; j < sb->s_blocksize &&
> + count + j < sbi->s_num_blocks/8; j++)
> + sum += nibblemap[map[j] & 0xf] +
> + nibblemap[(map[j] >> 4) & 0xf];
> + count += sb->s_blocksize;
> + }
> + return sum;
> +}
I think it would be helpful to express this using hweight64.
next prev parent reply other threads:[~2008-03-28 3:52 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-03-27 0:45 [PATCH 5/7] omfs: add bitmap routines Bob Copeland
2008-03-28 3:51 ` Arnd Bergmann [this message]
2008-03-28 13:26 ` Bob Copeland
2008-03-30 3:27 ` Bob Copeland
-- strict thread matches above, loose matches on Subject: below --
2008-04-12 22:58 Bob Copeland
2008-04-13 8:09 ` Christoph Hellwig
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=200803280451.11216.arnd@arndb.de \
--to=arnd@arndb.de \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=me@bobcopeland.com \
/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