diff options
author | Jon Santmyer <jon@jonsantmyer.com> | 2024-05-22 13:00:41 -0400 |
---|---|---|
committer | Jon Santmyer <jon@jonsantmyer.com> | 2024-05-22 13:00:41 -0400 |
commit | ace65b453151845bc361f21f3e5b651c35f9f126 (patch) | |
tree | 262ebd29b0ca1d8584f0b6f1efa7a00d9f4f3e43 /lib/buddymap.h | |
parent | f004c1ade8d617a82cea2fe249434cccb47a2358 (diff) | |
download | jove-kernel-ace65b453151845bc361f21f3e5b651c35f9f126.tar.gz jove-kernel-ace65b453151845bc361f21f3e5b651c35f9f126.tar.bz2 jove-kernel-ace65b453151845bc361f21f3e5b651c35f9f126.zip |
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 |