fix bit search index
This commit is contained in:
parent
08e0f14c2a
commit
89bdcd43b2
@ -164,13 +164,14 @@ static bool mi_region_alloc_blocks(mem_region_t* region, size_t idx, size_t bloc
|
|||||||
|
|
||||||
const uintptr_t mask = mi_region_block_mask(blocks,0);
|
const uintptr_t mask = mi_region_block_mask(blocks,0);
|
||||||
const size_t bitidx_max = MI_REGION_MAP_BITS - blocks;
|
const size_t bitidx_max = MI_REGION_MAP_BITS - blocks;
|
||||||
size_t bitidx = 0;
|
size_t bitidx ;
|
||||||
uintptr_t map;
|
uintptr_t map;
|
||||||
uintptr_t newmap;
|
uintptr_t newmap;
|
||||||
do { // while no atomic claim success and not all bits seen
|
do { // while no atomic claim success and not all bits seen
|
||||||
// find the first free range of bits
|
// find the first free range of bits
|
||||||
map = mi_atomic_read(®ion->map);
|
map = mi_atomic_read(®ion->map);
|
||||||
size_t m = map;
|
size_t m = map;
|
||||||
|
bitidx = 0;
|
||||||
do {
|
do {
|
||||||
// skip ones
|
// skip ones
|
||||||
while ((m&1) == 1) { bitidx++; m>>=1; }
|
while ((m&1) == 1) { bitidx++; m>>=1; }
|
||||||
|
Loading…
Reference in New Issue
Block a user