freelist: Move align macro fiddling into header
This commit is contained in:
parent
39c331cd09
commit
be3d902be5
2 changed files with 13 additions and 13 deletions
|
|
@ -5,6 +5,19 @@
|
|||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
/* Fiddle these around according to your need. Delete or check makefile */
|
||||
#ifdef FREELIST_NOALIGN
|
||||
#define ALIGN(x) (x)
|
||||
#else // FREELIST_NOALIGN
|
||||
|
||||
/* Align to nearest multiple of sizeof(void*) */
|
||||
static inline size_t align_up(size_t n) {
|
||||
return (n + sizeof(void *) - 1) & ~(sizeof(void *) - 1);
|
||||
}
|
||||
|
||||
#define ALIGN(x) (align_up(x))
|
||||
#endif // FREELIST_NOALIGN
|
||||
|
||||
#define FL_FREE ((uint8_t)0x00)
|
||||
#define FL_USED ((uint8_t)0x01)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue