Hierarchical bitmap allocator

This commit is contained in:
Vitaliy Filippov
2019-10-28 01:22:01 +03:00
commit e91952e89e
2 changed files with 140 additions and 0 deletions
+16
View File
@@ -0,0 +1,16 @@
#pragma once
#include <stdint.h>
// Hierarchical bitmap allocator
struct allocator
{
uint64_t size;
uint64_t last_one_mask;
uint64_t mask[];
};
allocator *allocator_create(uint64_t blocks);
void allocator_destroy(allocator *alloc);
void allocator_set(allocator *alloc, uint64_t addr, bool value);
uint64_t allocator_find_free(allocator *alloc);