Merge pull request #331 from devnexen/mi_bitmap_try_find_claim_field_accross_little_chg

mi_bitmap_try_find_claim_field_across
This commit is contained in:
Daan 2020-12-10 11:57:08 -08:00 committed by GitHub
commit 7958d0df57
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -179,7 +179,7 @@ static bool mi_bitmap_try_find_claim_field_across(mi_bitmap_t bitmap, size_t bit
_Atomic(uintptr_t)* field = &bitmap[idx];
uintptr_t map = mi_atomic_load_relaxed(field);
const size_t initial = mi_clz(map); // count of initial zeros starting at idx
mi_assert_internal(initial >= 0 && initial <= MI_BITMAP_FIELD_BITS);
mi_assert_internal(initial <= MI_BITMAP_FIELD_BITS);
if (initial == 0) return false;
if (initial >= count) return _mi_bitmap_try_find_claim_field(bitmap, idx, count, bitmap_idx); // no need to cross fields
if (_mi_divide_up(count - initial, MI_BITMAP_FIELD_BITS) >= (bitmap_fields - idx)) return false; // not enough entries