welp i'll fix it tomorrow
This commit is contained in:
parent
941bac31b6
commit
27eb1f10b1
7 changed files with 143 additions and 56 deletions
|
|
@ -6,7 +6,7 @@
|
|||
/* By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/05/07 09:48:17 by maiboyer #+# #+# */
|
||||
/* Updated: 2024/05/07 10:14:16 by maiboyer ### ########.fr */
|
||||
/* Updated: 2024/05/07 22:03:02 by maiboyer ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -15,13 +15,21 @@
|
|||
|
||||
#include "me/alloc/alloc.h"
|
||||
#include "me/types.h"
|
||||
#include <stdalign.h>
|
||||
|
||||
#define ARENA_SIZE 16384
|
||||
#define ARENA_SIZE_DEFAULT 4096
|
||||
|
||||
typedef struct s_arena_block
|
||||
{
|
||||
t_usize size;
|
||||
bool end;
|
||||
bool free;
|
||||
t_u8 padding[6];
|
||||
} t_arena_block;
|
||||
|
||||
typedef struct s_arena_page
|
||||
{
|
||||
t_u8 bytes[ARENA_SIZE];
|
||||
t_usize current_index;
|
||||
t_usize page_size;
|
||||
struct s_arena_page *next;
|
||||
} t_arena_page;
|
||||
|
||||
|
|
@ -29,6 +37,8 @@ typedef struct s_arena_page
|
|||
t_arena_page *get_head_arena(void);
|
||||
|
||||
// Will return ERROR if it couldn't malloc the page
|
||||
t_error alloc_arena(t_arena_page **out);
|
||||
t_error alloc_arena_page(t_usize min_size, t_arena_page **out);
|
||||
|
||||
t_error get_block_for_page(t_usize size, t_arena_page *page, t_arena_block **out);
|
||||
|
||||
#endif /* ALLOC_INTERNAL_H */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue