]> git.proxmox.com Git - mirror_ubuntu-disco-kernel.git/commitdiff
qnx4: use hweight8
authorAkinobu Mita <akinobu.mita@gmail.com>
Wed, 16 Dec 2009 00:48:24 +0000 (16:48 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Wed, 16 Dec 2009 15:20:18 +0000 (07:20 -0800)
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>
fs/qnx4/bitmap.c

index a17440bce018cb5d7bbc68cb0c56a8658e17dc45..22e0d60e53efbe3072ade881ec69251062df83c9 100644 (file)
@@ -28,22 +28,7 @@ static void count_bits(register const char *bmPart, register int size,
        }
        do {
                b = *bmPart++;
-               if ((b & 1) == 0)
-                       tot++;
-               if ((b & 2) == 0)
-                       tot++;
-               if ((b & 4) == 0)
-                       tot++;
-               if ((b & 8) == 0)
-                       tot++;
-               if ((b & 16) == 0)
-                       tot++;
-               if ((b & 32) == 0)
-                       tot++;
-               if ((b & 64) == 0)
-                       tot++;
-               if ((b & 128) == 0)
-                       tot++;
+               tot += 8 - hweight8(b);
                size--;
        } while (size != 0);
        *tf = tot;