library/src/mmap/BP-MMapSlabAllocator.cc
// Search the allocated pointers and try to find the correct index for the referenced lookup_entry pointer.
Search the allocated pointers and try to find the correct index for the referenced lookup_entry pointer.
Search the allocated pointers and try to find the correct index for the referenced lookup_entry pointer .
size_t BP_SlabAllocGetEntryIDXFromEntryPtr(P_BP_MMAP_SLAB_ALLOCATOR allocator, P_BP_MMAP_SLAB_ENTRY_HDR lookup_entry)
{
	if(!allocator)
		return (size_t) -1;
	if(!lookup_entry)
		return (size_t) -1;
	size_t n = 0;
	BP_SLAB_ALLOCATOR_ITER_LOOP_ALL(allocator)
	{
		if(allocator->curr_entry == lookup_entry)
			return n;
		n++;
	}
	return (size_t) -1;
}
size_t BP_SlabAllocGetEntryIDXFromEntryPtr ( P_BP_MMAP_SLAB_ALLOCATOR allocator , P_BP_MMAP_SLAB_ENTRY_HDR lookup_entry ) { if ( ! allocator ) return ( size_t ) -1 ; if ( ! lookup_entry ) return ( size_t ) -1 ; size_t n = 0 ; BP_SLAB_ALLOCATOR_ITER_LOOP_ALL ( allocator ) { if ( allocator -> curr_entry == lookup_entry ) return n ; n ++ ; } return ( size_t ) -1 ; }
Search the allocated pointers and try to find the correct index for the referenced lookup_entry pointer.
Search the allocated pointers and try to find the correct index for the referenced lookup_entry pointer .
// ensure we have an allocator and a lookup // set the iterator // return the index if we found it // increase the index counter and continue the loop if not // return erroneously if unable to lookup data