summaryrefslogtreecommitdiff
path: root/yaffs_bitmap.c
diff options
context:
space:
mode:
authorCharles Manning <cdhmanning@gmail.com>2010-12-06 10:45:02 +1300
committerCharles Manning <cdhmanning@gmail.com>2010-12-06 10:45:02 +1300
commit7620f7d1207e72dc6b3c58bc452000b9ec82b57b (patch)
tree50eb59c325f7871dac35859645c9b7590e5a1ceb /yaffs_bitmap.c
parent84f122f301b6a27295641fcbde3a6fbcfea78a99 (diff)
yaffs : Change bitmap counting function to use hweight8()
Better than shift counting. Signed-off-by: Charles Manning <cdhmanning@gmail.com>
Diffstat (limited to 'yaffs_bitmap.c')
-rw-r--r--yaffs_bitmap.c12
1 files changed, 3 insertions, 9 deletions
diff --git a/yaffs_bitmap.c b/yaffs_bitmap.c
index 5d1cfb2..b254266 100644
--- a/yaffs_bitmap.c
+++ b/yaffs_bitmap.c
@@ -90,15 +90,9 @@ int yaffs_count_chunk_bits(struct yaffs_dev *dev, int blk)
u8 *blk_bits = yaffs_block_bits(dev, blk);
int i;
int n = 0;
- for (i = 0; i < dev->chunk_bit_stride; i++) {
- u8 x = *blk_bits;
- while (x) {
- if (x & 1)
- n++;
- x >>= 1;
- }
- blk_bits++;
- }
+ for (i = 0; i < dev->chunk_bit_stride; i++, blk_bits++)
+ n += hweight8(*blk_bits);
+
return n;
}