[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1258106265-18181-1-git-send-email-akinobu.mita@gmail.com>
Date: Fri, 13 Nov 2009 18:57:45 +0900
From: Akinobu Mita <akinobu.mita@...il.com>
To: akpm@...ux-foundation.org, linux-kernel@...r.kernel.org
Cc: Akinobu Mita <akinobu.mita@...il.com>,
Anders Larsen <al@...rsen.net>,
Al Viro <viro@...iv.linux.org.uk>
Subject: [PATCH v2] qnx4: Use hweight8
> The original code counted the number of zeroes whereas hweight8() counts ones, so
>
> NAK
>
> (hint: "tot += 8 - hweight8(b)" should do the trick)
Oops,
Subject: [PATCH v2] qnx4: Use hweight8
Use hweight8 instead of counting for each bit
[ v2: count_bit() counts zero bits in the bitmap]
Signed-off-by: Akinobu Mita <akinobu.mita@...il.com>
Cc: Anders Larsen <al@...rsen.net>
Cc: Al Viro <viro@...iv.linux.org.uk>
---
fs/qnx4/bitmap.c | 17 +----------------
1 files changed, 1 insertions(+), 16 deletions(-)
diff --git a/fs/qnx4/bitmap.c b/fs/qnx4/bitmap.c
index 0afba06..cbaae72 100644
--- a/fs/qnx4/bitmap.c
+++ b/fs/qnx4/bitmap.c
@@ -35,22 +35,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;
--
1.6.5.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists