forked from KolibriOS/kolibrios
ddk: 3.19-rc1
git-svn-id: svn://kolibrios.org@5270 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
@@ -132,7 +132,9 @@ void __bitmap_shift_right(unsigned long *dst,
|
||||
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 @@ void __bitmap_shift_left(unsigned long *dst,
|
||||
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,30 +327,32 @@ void bitmap_clear(unsigned long *map, unsigned int start, int len)
|
||||
}
|
||||
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:
|
||||
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 @@ again:
|
||||
}
|
||||
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 @@ EXPORT_SYMBOL(bitmap_bitremap);
|
||||
*
|
||||
* 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
|
||||
*
|
||||
|
Reference in New Issue
Block a user