Skip to content

Commit 868d648

Browse files
mitatorvalds
authored andcommitted
qnx4: use hweight8
Use hweight8 instead of counting for each bit Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com> Acked-by: Anders Larsen <al@alarsen.net> 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 ca120b2 commit 868d648

1 file changed

Lines changed: 1 addition & 16 deletions

File tree

‎fs/qnx4/bitmap.c‎

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -28,22 +28,7 @@ static void count_bits(register const char *bmPart, register int size,
2828
}
2929
do {
3030
b = *bmPart++;
31-
if ((b & 1) == 0)
32-
tot++;
33-
if ((b & 2) == 0)
34-
tot++;
35-
if ((b & 4) == 0)
36-
tot++;
37-
if ((b & 8) == 0)
38-
tot++;
39-
if ((b & 16) == 0)
40-
tot++;
41-
if ((b & 32) == 0)
42-
tot++;
43-
if ((b & 64) == 0)
44-
tot++;
45-
if ((b & 128) == 0)
46-
tot++;
31+
tot += 8 - hweight8(b);
4732
size--;
4833
} while (size != 0);
4934
*tf = tot;

0 commit comments

Comments
 (0)