[space-map-disk] fix the search range (#117)

This commit is contained in:
Ming-Hung Tsai 2019-01-03 18:46:35 +08:00 committed by Joe Thornber
parent 95ae4fef6a
commit 8abac422b2

View File

@ -390,7 +390,8 @@ namespace {
bitmap bm(tm_, ie, bitmap_validator_); bitmap bm(tm_, ie, bitmap_validator_);
unsigned bit_begin = (index == begin_index) ? (begin % ENTRIES_PER_BLOCK) : 0; unsigned bit_begin = (index == begin_index) ? (begin % ENTRIES_PER_BLOCK) : 0;
unsigned bit_end = (index == end_index - 1) ? (end % ENTRIES_PER_BLOCK) : ENTRIES_PER_BLOCK; unsigned bit_end = (index == end_index - 1) ?
(end - ENTRIES_PER_BLOCK * index) : ENTRIES_PER_BLOCK;
boost::optional<unsigned> maybe_b = bm.find_free(bit_begin, bit_end); boost::optional<unsigned> maybe_b = bm.find_free(bit_begin, bit_end);
if (maybe_b) { if (maybe_b) {