Compare commits

..

No commits in common. "de6aee3a3a9fc113d6bac4c8cd31b431fad02e8c" and "3d4fe51dd1c1065050dafe4047b54fa34efa21f8" have entirely different histories.

2 changed files with 10 additions and 9 deletions

View file

@ -6,10 +6,6 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
struct FreeListBlock {
struct FreeListBlock *next;
};
/* Initialize the FreeList */ /* Initialize the FreeList */
int fl_init(FreeList *fl, uintptr_t start, uintptr_t end, size_t itemsize) { int fl_init(FreeList *fl, uintptr_t start, uintptr_t end, size_t itemsize) {
size_t size = ALIGN(itemsize); size_t size = ALIGN(itemsize);

View file

@ -18,14 +18,19 @@ static inline size_t align_up(size_t n) {
#define ALIGN(x) (align_up(x)) #define ALIGN(x) (align_up(x))
#endif // FREELIST_NOALIGN #endif // FREELIST_NOALIGN
typedef struct FreeListBlock FreeListBlock; #define FL_FREE ((uint8_t)0x00)
#define FL_USED ((uint8_t)0x01)
typedef struct FreeListBlock {
struct FreeListBlock *next;
} FreeListBlock;
typedef struct { typedef struct {
uintptr_t start; uintptr_t start;
uintptr_t end; uintptr_t end;
FreeListBlock *free; FreeListBlock *free;
size_t size; size_t size;
size_t allocated; size_t allocated;
} FreeList; } FreeList;
int fl_init(FreeList *fl, uintptr_t start, uintptr_t end, size_t itemsize); int fl_init(FreeList *fl, uintptr_t start, uintptr_t end, size_t itemsize);