previous | start | next

Additional Macros

To build a header or footer valueyou need

#define PACK(size, alloc) ((size) | (alloc))
     

To store or read the header or footer (an integer, not a byte) value:

/* p points to a header or footer */
#define GET(p) ( *(size_t *)(p) )
#define PUT(p, val) ( *(size_t *)(p) = (val) )
     

Why so many parentheses in macro definitions?

Miscellaneous macros

#define OVERHEAD 8                 /* size of header + footer in bytes  */
#define CHUNKSIZE (1 << 12)  /* initial heap size in bytes (4096) */
     


previous | start | next