how to code the following functions? please help!
Thank you very much!
void * aligned_malloc(size_t bytes, size_t alignment); void aligned_free(void* p);
aligned_malloc and aligned_free functions may only use the c runtime functions malloc and free in their implementation and cannot use any static memory.
aligned_malloc takes the size of the buffer you would like to allocate and also alignemnt which is a power of two that will force the starting address of the buffer you return to the user to start on an alignemnt boundary.
for example, a user may request 1000 bytes starting on a 128 byte boundary by calling aligned_malloc(1000, 128). aligned_free frees the buffer returned from aligned_malloc.