Make allocator a class

This commit is contained in:
Vitaliy Filippov
2019-11-27 00:50:57 +03:00
parent b8e53f8c67
commit ff7469ee91
7 changed files with 39 additions and 40 deletions
+7 -7
View File
@@ -3,14 +3,14 @@
#include <stdint.h>
// Hierarchical bitmap allocator
struct allocator
class allocator
{
uint64_t size;
uint64_t last_one_mask;
uint64_t mask[];
uint64_t *mask;
public:
allocator(uint64_t blocks);
~allocator();
void set(uint64_t addr, bool value);
uint64_t find_free();
};
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);