lkml.org 
[lkml]   [2010]   [Nov]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH 4/9] Add yaffs ecc, mtd access and nand abstraction code
    On 11/03/2010 09:53 AM, cdhmanning@gmail.com wrote:
    > From: Charles Manning<cdhmanning@gmail.com>
    [...]
    > --- /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


    \
     
     \ /
      Last update: 2010-11-03 18:07    [W:4.738 / U:1.152 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site