diff --git a/freelist/freelist.c b/freelist/freelist.c index 9b47a8d..7fd946e 100644 --- a/freelist/freelist.c +++ b/freelist/freelist.c @@ -5,19 +5,6 @@ #include #include -/* Fiddle these around according to your need. */ -#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 - /* Initialize the FreeList */ int fl_init(FreeList *fl, uintptr_t start, uintptr_t end, size_t itemsize) { size_t size = ALIGN(itemsize + sizeof(FreeListBlock)); diff --git a/freelist/freelist.h b/freelist/freelist.h index de12d5d..f0e8ed4 100644 --- a/freelist/freelist.h +++ b/freelist/freelist.h @@ -5,6 +5,19 @@ #include #include +/* 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)