ae2f_docs
c89atomic_bitmap_allocator.h
1/*
2This does not do input parameter validation for null pointers. You must do this manually before calling any functions.
3*/
4#ifndef c89atomic_bitmap_allocator_h
5#define c89atomic_bitmap_allocator_h
6
7#include "../c89atomic.h"
8
9#ifndef C89ATOMIC_BITMAP_ALLOCATOR_API
10#define C89ATOMIC_BITMAP_ALLOCATOR_API
11#endif
12
13typedef enum
14{
15 C89ATOMIC_BITMAP_ALLOCATOR_SUCCESS = 0,
16 C89ATOMIC_BITMAP_ALLOCATOR_INVALID_ARGS,
17 C89ATOMIC_BITMAP_ALLOCATOR_OUT_OF_MEMORY /* Can be returned when allocating. */
18} c89atomic_bitmap_allocator_result;
19
20
21/* BEG c89atomic_bitmap_allocator.h */
23{
24 c89atomic_uint32* bitmap;
25 size_t sizeInWords;
26} c89atomic_bitmap_allocator;
27
28C89ATOMIC_BITMAP_ALLOCATOR_API c89atomic_bitmap_allocator_result c89atomic_bitmap_allocator_init(void* pBitmap, size_t sizeInBits, c89atomic_bitmap_allocator* pAllocator);
29C89ATOMIC_BITMAP_ALLOCATOR_API c89atomic_bitmap_allocator_result c89atomic_bitmap_allocator_alloc(c89atomic_bitmap_allocator* pAllocator, size_t* pIndex);
30C89ATOMIC_BITMAP_ALLOCATOR_API void c89atomic_bitmap_allocator_free(c89atomic_bitmap_allocator* pAllocator, size_t index);
31/* END c89atomic_bitmap_allocator.h */
32
33#endif /* c89atomic_bitmap_allocator_h */
#define c89atomic_memory_order_relaxed
Definition c89atomic.h:580
#define c89atomic_memory_order_acq_rel
Definition c89atomic.h:584
#define C89ATOMIC_BITMAP_ALLOCATOR_API