Re: [PATCH 4/9] Add yaffs ecc, mtd access and nand abstraction code

From: David Daney
Date: Wed Nov 03 2010 - 13:05:24 EST


On 11/03/2010 09:53 AM, cdhmanning@xxxxxxxxx wrote:
From: Charles Manning<cdhmanning@xxxxxxxxx>
[...]
--- /dev/null
+++ b/fs/yaffs2/yaffs_ecc.c
[...]
+
+/* Count the bits in an unsigned char or a U32 */
+
+static int yaffs_count_bits(unsigned char x)
+{
+ int r = 0;
+ while (x) {
+ if (x& 1)
+ r++;
+ x>>= 1;
+ }
+ return r;
+}
+
+static int yaffs_count_bits32(unsigned x)
+{
+ int r = 0;
+ while (x) {
+ if (x& 1)
+ r++;
+ x>>= 1;
+ }
+ return r;
+}
+

These two can probably be replaced with the standard hweight32() and hweight8().

David Daney
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/