Messages in this thread | | | Date | Mon, 1 Nov 2010 21:04:21 +0200 | Subject | Re: [PATCH 08/29] Staging: yaffs2: yaffs_ecc: Add files | From | Pekka Enberg <> |
| |
On Mon, Nov 1, 2010 at 8:40 PM, Tracey Dent <tdent48227@gmail.com> wrote: > Adding files to yaffs2 directory. > > Signed-off-by: Tracey Dent <tdent48227@gmail.com> > --- > drivers/staging/yaffs2/yaffs_ecc.c | 323 ++++++++++++++++++++++++++++++++++++ > drivers/staging/yaffs2/yaffs_ecc.h | 44 +++++ > 2 files changed, 367 insertions(+), 0 deletions(-) > create mode 100644 drivers/staging/yaffs2/yaffs_ecc.c > create mode 100644 drivers/staging/yaffs2/yaffs_ecc.h > > + > +/* 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; > +}
Looks like bitmap_weight() to me. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |