Compare commits
2 commits
3d4fe51dd1
...
de6aee3a3a
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
de6aee3a3a | ||
|
|
682901cafd |
2 changed files with 9 additions and 10 deletions
|
|
@ -6,6 +6,10 @@
|
|||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
struct FreeListBlock {
|
||||
struct FreeListBlock *next;
|
||||
};
|
||||
|
||||
/* Initialize the FreeList */
|
||||
int fl_init(FreeList *fl, uintptr_t start, uintptr_t end, size_t itemsize) {
|
||||
size_t size = ALIGN(itemsize);
|
||||
|
|
|
|||
|
|
@ -18,19 +18,14 @@ static inline size_t align_up(size_t n) {
|
|||
#define ALIGN(x) (align_up(x))
|
||||
#endif // FREELIST_NOALIGN
|
||||
|
||||
#define FL_FREE ((uint8_t)0x00)
|
||||
#define FL_USED ((uint8_t)0x01)
|
||||
|
||||
typedef struct FreeListBlock {
|
||||
struct FreeListBlock *next;
|
||||
} FreeListBlock;
|
||||
typedef struct FreeListBlock FreeListBlock;
|
||||
|
||||
typedef struct {
|
||||
uintptr_t start;
|
||||
uintptr_t end;
|
||||
uintptr_t start;
|
||||
uintptr_t end;
|
||||
FreeListBlock *free;
|
||||
size_t size;
|
||||
size_t allocated;
|
||||
size_t size;
|
||||
size_t allocated;
|
||||
} FreeList;
|
||||
|
||||
int fl_init(FreeList *fl, uintptr_t start, uintptr_t end, size_t itemsize);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue