/* Returns the nbits that a dbitmap can shrink to, 0 if not possible. */ staticinlineunsignedint dbitmap_shrink_nbits(struct dbitmap *dmap)
{ unsignedint bit;
if (dmap->nbits <= NBITS_MIN) return0;
/* *Determineifthebitmapcanshrinkbasedonthepositionof *itslastsetbit.Ifthebitiswithinthefirstquarterof *thebitmapthenshrinkingispossible.Inthiscase,the *bitmapshouldshrinktohalfitscurrentsize.
*/
bit = find_last_bit(dmap->map, dmap->nbits); if (bit < (dmap->nbits >> 2)) return dmap->nbits >> 1;
/* find_last_bit() returns dmap->nbits when no bits are set. */ if (bit == dmap->nbits) return NBITS_MIN;
return0;
}
/* Replace the internal bitmap with a new one of different size */ staticinlinevoid
dbitmap_replace(struct dbitmap *dmap, unsignedlong *new, unsignedint nbits)
{
bitmap_copy(new, dmap->map, min(dmap->nbits, nbits));
kfree(dmap->map);
dmap->map = new;
dmap->nbits = nbits;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.