diff options
Diffstat (limited to 'include')
| -rw-r--r-- | include/apos/bits.h | 24 | ||||
| -rw-r--r-- | include/apos/nodes.h | 4 |
2 files changed, 28 insertions, 0 deletions
diff --git a/include/apos/bits.h b/include/apos/bits.h index 699cba4..ca25007 100644 --- a/include/apos/bits.h +++ b/include/apos/bits.h @@ -12,6 +12,30 @@ #define __set_nbit(x, y) (__set_bit((x), 1UL << (y))) #define __clear_nbit(x, y) (__clear_bit((x), 1UL << (y))) +static inline bool bitmap_is_set(void *bmap, size_t n) +{ + uint8_t *bitmap = bmap; + size_t i = n / 8; + size_t r = n - (i * 8); + return __is_nset(bitmap[i], r); +} + +static inline void bitmap_set(void *bmap, size_t n) +{ + uint8_t *bitmap = bmap; + size_t i = n / 8; + size_t r = n - (i * 8); + __set_nbit(bitmap[i], r); +} + +static inline void bitmap_clear(void *bmap, size_t n) +{ + uint8_t *bitmap = bmap; + size_t i = n / 8; + size_t r = n - (i * 8); + __clear_nbit(bitmap[i], r); +} + uint16_t __bswap16(uint16_t u); uint32_t __bswap32(uint32_t u); uint64_t __bswap64(uint64_t u); diff --git a/include/apos/nodes.h b/include/apos/nodes.h index 80888e1..0780f75 100644 --- a/include/apos/nodes.h +++ b/include/apos/nodes.h @@ -16,6 +16,10 @@ struct node_region { struct node_root { size_t node_size; + size_t max_nodes; + + ptrdiff_t bitmap; + ptrdiff_t first_node; struct node_region *head; struct node_region *av_head; |
