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 <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);
|
||||||
|
|
|
||||||
|
|
@ -18,12 +18,7 @@ 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
|
||||||
|
|
||||||
#define FL_FREE ((uint8_t)0x00)
|
typedef struct FreeListBlock FreeListBlock;
|
||||||
#define FL_USED ((uint8_t)0x01)
|
|
||||||
|
|
||||||
typedef struct FreeListBlock {
|
|
||||||
struct FreeListBlock *next;
|
|
||||||
} FreeListBlock;
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
uintptr_t start;
|
uintptr_t start;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue