SNU-ARC / 2024_spring_sysprog_Lab3

7 stars 0 forks source link

About the predefined STATUS_MASK macro #19

Open m-joon-ixix opened 5 months ago

m-joon-ixix commented 5 months ago

There exists a pre-defined macro as below, on the given memmgr.c file.

#define STATUS_MASK        ((TYPE)(0x7))               ///< mask to retrieve flags from header/footer

Shouldn't this be 0x1, not 0x7?

ddony8128 commented 5 months ago

Block size should be a multiple of 32 so that the last 4 degrees of size is 0000 as a binary number.

If the status is free: the last 4 degree of header/footer -> 0000 If the status is allocated: the last 4 degree of header/footer -> 0001

So it's no matter to set STATUS_MASK as 1111, 0111, 0011, or 0001. ( respectively equal to 0xf, 0x7, 0x3, 0x1)