lkml.org 
[lkml]   [2003]   [Feb]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    From
    SubjectRe: [PATCH] 2.5.59 : sound/oss/vidc.c
    Date
    > >    for (new2size = 128; new2size < newsize; new2size <<= 1)
    > > ;
    > >
    > > The code seems to want to make the value of new2size a power of
    > > 2 and, greater than 128, but less than newsize. It ignores the
    > > fact that newsize might be less than 128, maybe this is okay.
    > > But, the code goes on, eventually settling on new2size being
    > > less than 4096... hmmm. I'll bet this could be greatly
    > > simplified. I think 'new2size' is really something that will
    > > fit inside 128-byte groups. Maybe an & or a % will greatly
    > > simplify?
    > >
    >
    > Isn't just a ffs or the like ?

    I'm just wondering whether

    if (newsize > 4096) newsize = 4096;

    can be removed, because:

    hwrate is verified to be between 3 and 255, so 10000/hwrate will be

    39 < hwrate < 3333

    and ignoring the lower two bits, (& ~3),

    36 < hwrate < 3332

    so:

    for (new2size = 128; new2size < newsize; new2size <<= 1) ;

    will never cause new2size to evaluate to more than 4096 anyway.

    (as far as I can see).

    John.
    -
    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/

    \
     
     \ /
      Last update: 2005-03-22 13:33    [W:0.019 / U:97.756 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site