place(void *bp, size_t asize): differenct case for last sizeclass

master
TuDatTr 2021-01-24 16:59:52 +01:00
parent 2a4dd8d48d
commit 995701749f
1 changed files with 8 additions and 2 deletions

10
mm.c
View File

@ -133,6 +133,14 @@ static void* extend_heap(size_t words);
static void place(void *bp, size_t asize)
{
size_t csize = GET_SIZE(HDRP(bp));
if (asize <= (2*(1 << (LISTSIZE-1)))) {
PUT(HDRP(bp), PACK(csize, 1));
PUT(FTRP(bp), PACK(csize, 1));
} else {
// Sonderfall 10
}
if ((csize - asize) >= (2*DSIZE)) {
PUT(HDRP(bp), PACK(asize, 1));
PUT(FTRP(bp), PACK(asize, 1));
@ -141,8 +149,6 @@ static void place(void *bp, size_t asize)
PUT(FTRP(bp), PACK(csize-asize, 0));
}
else {
PUT(HDRP(bp), PACK(csize, 1));
PUT(FTRP(bp), PACK(csize, 1));
}
}