lkml.org 
[lkml]   [2004]   [Apr]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    From
    Subject[Patch 2 of 17] cpumask v4 - Dont generate nonzero unused bits in bitmap
    mask2-bitmap-complement - Dont generate nonzero unused bits in bitmap
    Tighten up bitmap so it does not generate nonzero bits
    in the unused tail if it is not given any on input.

    Index: 2.6.5.bitmap/lib/bitmap.c
    ===================================================================
    --- 2.6.5.bitmap.orig/lib/bitmap.c 2004-04-05 02:50:25.000000000 -0700
    +++ 2.6.5.bitmap/lib/bitmap.c 2004-04-05 03:02:39.000000000 -0700
    @@ -26,10 +26,10 @@
    * carefully filter out these unused bits from impacting their
    * results.
    *
    - * Except for bitmap_complement, these operations hold to a
    - * slightly stronger rule: if you don't input any bitmaps to
    - * these ops that have some unused bits set, then they won't
    - * output any set unused bits in output bitmaps.
    + * These operations actually hold to a slightly stronger rule:
    + * if you don't input any bitmaps to these ops that have some
    + * unused bits set, then they won't output any set unused bits
    + * in output bitmaps.
    */

    #define MAX_BITMAP_BITS 512U /* for ia64 NR_CPUS maximum */
    @@ -83,11 +83,12 @@

    void bitmap_complement(unsigned long *bitmap, int bits)
    {
    - int k;
    - int nr = BITS_TO_LONGS(bits);
    -
    - for (k = 0; k < nr; ++k)
    + int k, lim = bits/BITS_PER_LONG;
    + for (k = 0; k < lim; ++k)
    bitmap[k] = ~bitmap[k];
    +
    + if (bits % BITS_PER_LONG)
    + bitmap[k] = ~bitmap[k] & ((1UL << (bits % BITS_PER_LONG)) - 1);
    }
    EXPORT_SYMBOL(bitmap_complement);


    --
    I won't rest till it's the best ...
    Programmer, Linux Scalability
    Paul Jackson <pj@sgi.com> 1.650.933.1373
    -
    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 14:02    [W:0.020 / U:29.504 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site