diff options
Diffstat (limited to 'lib/buddymap.h')
-rw-r--r-- | lib/buddymap.h | 35 |
1 files changed, 0 insertions, 35 deletions
diff --git a/lib/buddymap.h b/lib/buddymap.h deleted file mode 100644 index 1af8dfb..0000000 --- a/lib/buddymap.h +++ /dev/null @@ -1,35 +0,0 @@ -#ifndef JOVE_LIB_BUDDYMAP_H -#define JOVE_LIB_BUDDYMAP_H 1 - -#include <stddef.h> -#include <stdint.h> -#include <stdbool.h> - -#define BUDDY_BLOCK_BYTES sizeof(intmax_t) -#define BUDDY_BLOCK_BITS (BUDDY_BLOCK_BYTES * 8) - -#define BUDDY_BITS_FOR(range) (range * 2) -#define BUDDY_BLOCKS_FOR(range) (BUDDY_BITS_FOR(range) / BUDDY_BLOCK_BITS) - -struct BuddyMap -{ - size_t orders; - size_t bits; - size_t free; - uintmax_t **blocks; -}; - -#define BUDDY_BIT_PARTIAL 0 -#define BUDDY_BIT_FULL 1 - -bool buddy_bit_test(struct BuddyMap *map, size_t l, size_t i); -void buddy_bit_mark(struct BuddyMap *map, size_t l, size_t i); -void buddy_bit_free(struct BuddyMap *map, size_t l, size_t i); - -void buddy_mark_range(struct BuddyMap *map, size_t start, size_t end); -void buddy_free_range(struct BuddyMap *map, size_t start, size_t end); - -intmax_t buddy_alloc(struct BuddyMap *map, size_t length); -void buddy_free(struct BuddyMap *map, size_t i, size_t length); - -#endif |