memset(memory, FREE_FILL_CODE, size);
#endif
- ASSERT2((((uintptr_t)memory % sizeof(heap_buf_t)) == 0),
+ ASSERT2(((size_t)memory % alignof(heap_buf_t)) == 0,
"memory buffer is unaligned, please use the HEAP_DEFINE_BUF() macro to declare heap buffers!\n");
/* Initialize heap with a single big chunk */
* \param size Heap size in bytes.
*/
#define HEAP_DEFINE_BUF(name, size) \
- heap_buf_t name[((size) + sizeof(heap_buf_t) - 1) / sizeof(heap_buf_t)]; \
- STATIC_ASSERT(sizeof(name) % sizeof(heap_buf_t) == 0)
+ heap_buf_t name[((size) + sizeof(heap_buf_t) - 1) / sizeof(heap_buf_t)]
/// Initialize \a heap within the buffer pointed by \a memory which is of \a size bytes
void heap_init(struct Heap* heap, void* memory, size_t size);