kernel/mem_pool.c
/**
 *
 * @brief Determines which block set corresponds to the specified data size
 *
 * Finds the block set with the smallest blocks that can hold the specified
 * amount of data.
 *
 * @return block set index
 */
@brief Determines which block set corresponds to the specified data size
Finds the block set with the smallest blocks that can hold the specified
amount of data.

@return block set index
@brief Determines which block set corresponds to the specified data size Finds the block set with the smallest blocks that can hold the specified amount of data . @return block set index
static int compute_block_set_index(struct k_mem_pool *pool, size_t data_size)
{
	size_t block_size = pool->min_block_size;
	int offset = pool->nr_of_block_sets - 1;
	while (data_size > block_size) {
		block_size *= 4;
		offset--;
	}
	return offset;
}
static int compute_block_set_index ( struct k_mem_pool * pool , size_t data_size ) { size_t block_size = pool -> min_block_size ; int offset = pool -> nr_of_block_sets - 1 ; while ( data_size > block_size ) { block_size *= 4 ; offset -- ; } return offset ; }
@brief Determines which block set corresponds to the specified data size
 Finds the block set with the smallest blocks that can hold the specified
 amount of data.
@brief Determines which block set corresponds to the specified data size Finds the block set with the smallest blocks that can hold the specified amount of data .