Regionlist overhaul: Shrink struct regl

parent 8672597b
......@@ -45,7 +45,7 @@
struct regl {
unsigned magic;
#define REGL_MAGIC 0xe946b3c2
unsigned n, space;
uint16_t n, space;
struct buddy_ptr_page alloc;
VSTAILQ_ENTRY(regl) list;
struct buddy_off_extent arr[];
......@@ -150,8 +150,8 @@ regl_alloc_bits(buddy_t *membuddy, const uint8_t bits, int8_t cram,
r->magic = REGL_MAGIC;
b = sz / sizeof *r->arr;
assert(b <= UINT_MAX);
r->space = (unsigned)b;
assert(b <= UINT16_MAX);
r->space = (typeof(r->space))b;
r->alloc = alloc;
return (r);
}
......@@ -222,7 +222,7 @@ regionlist_add(struct regionlist *rl,
const struct buddy_off_extent *regs, unsigned n)
{
struct regl *regl;
unsigned av, nn;
uint16_t av, nn;
CHECK_OBJ_NOTNULL(rl, REGIONLIST_MAGIC);
regl = VSTAILQ_LAST(&rl->head, regl, list);
......@@ -240,7 +240,7 @@ regionlist_add(struct regionlist *rl,
if (av < n)
nn = av;
else
nn = n;
nn = (typeof(nn))n;
memcpy(&regl->arr[regl->n], regs, nn * sizeof *regs);
regl->n += nn;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment