Re: [PATCH 08/29] Staging: yaffs2: yaffs_ecc: Add files

From: Pekka Enberg
Date: Mon Nov 01 2010 - 15:04:28 EST


On Mon, Nov 1, 2010 at 8:40 PM, Tracey Dent <tdent48227@xxxxxxxxx> wrote:
> Adding files to yaffs2 directory.
>
> Signed-off-by: Tracey Dent <tdent48227@xxxxxxxxx>
> ---
>  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@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/