library/src/mmap/BP-MMapSlabAllocator.cc
// returns the number of adjacent entries
returns the number of adjacent entries
returns the number of adjacent entries
size_t BP_SlabAllocAvailableAdjacentEntries(P_BP_MMAP_SLAB_ALLOCATOR allocator, P_BP_MMAP_SLAB_ENTRY_HDR start_entry)
{
	if(!allocator)
		return 0;
	if(!start_entry)
		return 0;
	P_BP_MMAP_SLAB_ENTRY_HDR old_current = allocator->curr_entry;
	size_t available_n = 0;
	BP_SLAB_ALLOCATOR_ITER_LOOP(allocator, start_entry)
	{
		if(BP_FLAG_IS_SET(allocator->curr_entry->flags, BP_MMAP_SLAB_ENTRY_INFO_AVAILABLE))
		{
			available_n++;
		}
		else
		{
			break;
		}
	}
	allocator->curr_entry = old_current;
	return available_n;
}
size_t BP_SlabAllocAvailableAdjacentEntries ( P_BP_MMAP_SLAB_ALLOCATOR allocator , P_BP_MMAP_SLAB_ENTRY_HDR start_entry ) { if ( ! allocator ) return 0 ; if ( ! start_entry ) return 0 ; P_BP_MMAP_SLAB_ENTRY_HDR old_current = allocator -> curr_entry ; size_t available_n = 0 ; BP_SLAB_ALLOCATOR_ITER_LOOP ( allocator , start_entry ) { if ( BP_FLAG_IS_SET ( allocator -> curr_entry -> flags , BP_MMAP_SLAB_ENTRY_INFO_AVAILABLE ) ) { available_n ++ ; } else { break ; } } allocator -> curr_entry = old_current ; return available_n ; }
returns the number of adjacent entries
returns the number of adjacent entries
// preserve the old current entry as the loop iter modifies it and // we may be calling this from a routine that uses it. // loop iterator // loop entries // restore the old // return the count of adjacent available entries