implement heap_join for other > block

This commit is contained in:
mykola2312 2022-05-24 20:22:18 +03:00
parent 4947abc31c
commit 1071f9c6fd

10
heap.c
View file

@ -34,6 +34,16 @@ void heap_split(mblock_t* block, unsigned int size)
block->size = size;
}
void heap_join(mblock_t* block, mblock_t* other)
{
if (other > block)
{
mblock_t* next = (mblock_t*)((uint8_t*)other + other->size);
next->prev = block;
block->size += other->size;
}
}
int main()
{
printf("mblock_t\t%u\n", sizeof(mblock_t));