Back to home page

OSCL-LXR

 
 

    


0001 /* lib/bitmap.c pulls in at least two other files. */
0002 
0003 #include <linux/bitmap.h>
0004 
0005 void bitmap_clear(unsigned long *map, unsigned int start, int len)
0006 {
0007     unsigned long *p = map + BIT_WORD(start);
0008     const unsigned int size = start + len;
0009     int bits_to_clear = BITS_PER_LONG - (start % BITS_PER_LONG);
0010     unsigned long mask_to_clear = BITMAP_FIRST_WORD_MASK(start);
0011 
0012     while (len - bits_to_clear >= 0) {
0013         *p &= ~mask_to_clear;
0014         len -= bits_to_clear;
0015         bits_to_clear = BITS_PER_LONG;
0016         mask_to_clear = ~0UL;
0017         p++;
0018     }
0019     if (len) {
0020         mask_to_clear &= BITMAP_LAST_WORD_MASK(size);
0021         *p &= ~mask_to_clear;
0022     }
0023 }