Write and aligned malloc() that gets memory size needed and an alignment mask as its arguements. Write a free() function to go with the aligned malloc that takes only the pointer to the allocated chunk of memory.
Sigiloso
You basically need to allocated some extra memory with the memory segment that is requested so that you have enough space to align the said chunk and also save a pointer onto the original segment that you get from regular malloc. The free() method via some pointer math will get the "original pointer" and free it.