uint32_t leaf_count(struct node *leaf) { int i; uint32_t c = 0U; for (i = 0; i < leaf->n_children; i++) { struct lmb *lmb = leaf->parts[0].msgbuf; c += lmb_count(lmb); } return c; }
uint32_t node_count(struct node *n) { uint32_t c = 0U; if (n->height == 0) c += lmb_count(n->u.l.buffer); else { uint32_t i; for (i = 0; i < n->u.n.n_children; i++) { c += n->u.n.parts[i].buffer->count; } } return c; }
uint32_t node_count(struct node *node) { int i; uint32_t c = 0U; for (i = 0; i < node->n_children; i++) { struct child_pointer *ptr = &node->parts[i].ptr; if (node->height > 0) c += nmb_count(ptr->u.nonleaf->buffer); else c += lmb_count(ptr->u.leaf->buffer); } return c; }