/* Return the closest chunk ID corresponding to given memory pointer. Here "closest" is only meaningful in the context of sys_heap_aligned_alloc() where wanted alignment might not always correspond to a chunk header boundary.  */
static chunkid_t mem_to_chunkid(struct z_heap *h, void *p)
/* Return the closest chunk ID corresponding to given memory pointer. Here "closest" is only meaningful in the context of sys_heap_aligned_alloc() where wanted alignment might not always correspond to a chunk header boundary.  */
static chunkid_t mem_to_chunkid(struct z_heap *h, void *p)
{
	uint8_t *mem = p, *base = (uint8_t *)chunk_buf(h);
	return (mem - chunk_header_bytes(h) - base) / CHUNK_UNIT;
}