132,7 → 132,9 |
lower = src[off + k]; |
if (left && off + k == lim - 1) |
lower &= mask; |
dst[k] = upper << (BITS_PER_LONG - rem) | lower >> rem; |
dst[k] = lower >> rem; |
if (rem) |
dst[k] |= upper << (BITS_PER_LONG - rem); |
if (left && k == lim - 1) |
dst[k] &= mask; |
} |
173,7 → 175,9 |
upper = src[k]; |
if (left && k == lim - 1) |
upper &= (1UL << left) - 1; |
dst[k + off] = lower >> (BITS_PER_LONG - rem) | upper << rem; |
dst[k + off] = upper << rem; |
if (rem) |
dst[k + off] |= lower >> (BITS_PER_LONG - rem); |
if (left && k + off == lim - 1) |
dst[k + off] &= (1UL << left) - 1; |
} |
323,23 → 327,25 |
} |
EXPORT_SYMBOL(bitmap_clear); |
|
/* |
* bitmap_find_next_zero_area - find a contiguous aligned zero area |
/** |
* bitmap_find_next_zero_area_off - find a contiguous aligned zero area |
* @map: The address to base the search on |
* @size: The bitmap size in bits |
* @start: The bitnumber to start searching at |
* @nr: The number of zeroed bits we're looking for |
* @align_mask: Alignment mask for zero area |
* @align_offset: Alignment offset for zero area. |
* |
* The @align_mask should be one less than a power of 2; the effect is that |
* the bit offset of all zero areas this function finds is multiples of that |
* power of 2. A @align_mask of 0 means no alignment is required. |
* the bit offset of all zero areas this function finds plus @align_offset |
* is multiple of that power of 2. |
*/ |
unsigned long bitmap_find_next_zero_area(unsigned long *map, |
unsigned long bitmap_find_next_zero_area_off(unsigned long *map, |
unsigned long size, |
unsigned long start, |
unsigned int nr, |
unsigned long align_mask) |
unsigned long align_mask, |
unsigned long align_offset) |
{ |
unsigned long index, end, i; |
again: |
346,7 → 352,7 |
index = find_next_zero_bit(map, size, start); |
|
/* Align allocation */ |
index = __ALIGN_MASK(index, align_mask); |
index = __ALIGN_MASK(index + align_offset, align_mask) - align_offset; |
|
end = index + nr; |
if (end > size) |
358,7 → 364,7 |
} |
return index; |
} |
EXPORT_SYMBOL(bitmap_find_next_zero_area); |
EXPORT_SYMBOL(bitmap_find_next_zero_area_off); |
|
/* |
* Bitmap printing & parsing functions: first version by Nadia Yvette Chambers, |
599,7 → 605,7 |
* |
* Further lets say we use the following code, invoking |
* bitmap_fold() then bitmap_onto, as suggested above to |
* avoid the possitility of an empty @dst result: |
* avoid the possibility of an empty @dst result: |
* |
* unsigned long *tmp; // a temporary bitmap's bits |
* |