projects
/
yaffs2.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
84f122f
)
yaffs : Change bitmap counting function to use hweight8()
author
Charles Manning
<cdhmanning@gmail.com>
Sun, 5 Dec 2010 21:45:02 +0000
(10:45 +1300)
committer
Charles Manning
<cdhmanning@gmail.com>
Sun, 5 Dec 2010 21:45:02 +0000
(10:45 +1300)
Better than shift counting.
Signed-off-by: Charles Manning <cdhmanning@gmail.com>
yaffs_bitmap.c
patch
|
blob
|
history
diff --git
a/yaffs_bitmap.c
b/yaffs_bitmap.c
index 5d1cfb2965197ba853011551571e2301ec5e9a6d..b2542660b22a5ee12c86a662cedbe45c7abec3af 100644
(file)
--- 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;
}