/* reset alignment to 1 if we are matching a specific offset */ /* adjust alignment - 1 to get to the format expected in bitmaps */
a = (offset > 0) ? 0 : a - 1;
/* FIXME Return error if slots_per_band > stride */
/* skip forward if we are not at right offset */ if (bit_offset > 0 && (*pos % slots_per_band != bit_offset)) {
curr_bit = ALIGN(*pos, slots_per_band) + bit_offset; continue;
}
/* skip forward to next row if we overlap end of row */ if ((*pos % slot_stride) + w > slot_stride) {
curr_bit = ALIGN(*pos, slot_stride) + bit_offset; continue;
}
/* TODO: Handle overlapping 4K boundaries */
/* break out of look if we will go past end of container */ if ((*pos + slot_stride * h) > num_bits) break;
/* generate mask that represents out matching pattern */
bitmap_clear(mask, 0, slot_stride);
bitmap_set(mask, (*pos % BITS_PER_LONG), w);
/* assume the area is free until we find an overlap */
area_free = true;
/* check subsequent rows to see if complete area is free */ for (i = 1; i < h; i++) {
index = *pos / BITS_PER_LONG + i * 8; if (bitmap_intersects(&map[index], mask,
(*pos % BITS_PER_LONG) + w)) {
area_free = false; break;
}
}
if (area_free) break;
/* go forward past this match */ if (bit_offset > 0)
curr_bit = ALIGN(*pos, slots_per_band) + bit_offset; else
curr_bit = *pos + a + 1;
}
if (area_free) { /* set area as in-use. iterate over rows */ for (i = 0, index = *pos; i < h; i++, index += slot_stride)
bitmap_set(map, index, w);
}
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.