clang-format
This commit is contained in:
@@ -29,26 +29,24 @@
|
||||
*/
|
||||
|
||||
struct poolctl {
|
||||
uint32_t *inuse;
|
||||
unsigned max;
|
||||
const char *itemtype;
|
||||
const char *maxname;
|
||||
const char *file;
|
||||
uint32_t *inuse;
|
||||
unsigned max;
|
||||
const char *itemtype;
|
||||
const char *maxname;
|
||||
const char *file;
|
||||
};
|
||||
|
||||
#define DIVROUNDUP(a, b) (((a) + (b) - 1) / (b))
|
||||
#define ROUNDUP(a, b) (DIVROUNDUP(a, b) * (b))
|
||||
#define DIVROUNDUP(a, b) (((a) + (b) - 1) / (b))
|
||||
#define ROUNDUP(a, b) (DIVROUNDUP(a, b) * (b))
|
||||
|
||||
#define DECLPOOL(T, MAX) \
|
||||
static struct T pool_space_##T[ROUNDUP(MAX, 32)]; \
|
||||
static uint32_t pool_inuse_##T[DIVROUNDUP(MAX, 32)]; \
|
||||
static struct poolctl pool_##T = { \
|
||||
.inuse = pool_inuse_##T, \
|
||||
.max = ROUNDUP(MAX, 32), \
|
||||
.itemtype = "struct " #T, \
|
||||
.maxname = #MAX, \
|
||||
.file = __FILE__ \
|
||||
}
|
||||
#define DECLPOOL(T, MAX) \
|
||||
static struct T pool_space_##T[ROUNDUP(MAX, 32)]; \
|
||||
static uint32_t pool_inuse_##T[DIVROUNDUP(MAX, 32)]; \
|
||||
static struct poolctl pool_##T = {.inuse = pool_inuse_##T, \
|
||||
.max = ROUNDUP(MAX, 32), \
|
||||
.itemtype = "struct " #T, \
|
||||
.maxname = #MAX, \
|
||||
.file = __FILE__}
|
||||
|
||||
#define POOLALLOC(T) (&pool_space_##T[poolalloc(&pool_##T)])
|
||||
#define POOLFREE(T, x) (poolfree(&pool_##T, (x) - pool_space_##T))
|
||||
|
||||
Reference in New Issue
Block a user