mast->r->node = mte_node_or_none(right);
mast->l->min = mast->orig_l->min;
- mast->l->max = mast->bn->pivot[split];
mab_mas_cp(mast->bn, 0, split, mast->l, true);
mast->r->max = mast->l->max;
+ if (split == mast->bn->b_end) {
+ mast->l->max = mast->orig_r->max;
+ return;
+ }
if (middle) {
mab_mas_cp(mast->bn, 1 + split, mid_split, mast->m, true);
if (right)
mte_set_parent(right, l_mas.node, ++slot);
+ if (mas_is_root_limits(mast->l)) {
new_root:
- if (mas_is_root_limits(mast->l))
mast_new_root(mast, mas);
- else
+ } else {
mas_mn(&l_mas)->parent = mas_mn(mast->orig_l)->parent;
+ }
if (!mte_dead_node(mast->orig_l->node))
mat_add(&free, mast->orig_l->node);