Skip to content

Commit c2923c3

Browse files
mitatorvalds
authored andcommitted
hpfs: use hweight32
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> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent e3c96f5 commit c2923c3

1 file changed

Lines changed: 2 additions & 5 deletions

File tree

‎fs/hpfs/super.c‎

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -119,11 +119,8 @@ unsigned hpfs_count_one_bitmap(struct super_block *s, secno secno)
119119
unsigned i, count;
120120
if (!(bits = hpfs_map_4sectors(s, secno, &qbh, 4))) return 0;
121121
count = 0;
122-
for (i = 0; i < 2048 / sizeof(unsigned); i++) {
123-
unsigned b;
124-
if (!bits[i]) continue;
125-
for (b = bits[i]; b; b>>=1) count += b & 1;
126-
}
122+
for (i = 0; i < 2048 / sizeof(unsigned); i++)
123+
count += hweight32(bits[i]);
127124
hpfs_brelse4(&qbh);
128125
return count;
129126
}

0 commit comments

Comments
 (0)