static int ma_split(struct ma_state *mas, unsigned char slot,
unsigned char num, int depth)
{
- struct maple_node *enc_full = mas->node; // Encoded full node.
struct maple_node *full = mt_to_node(mas->node);
unsigned char split, p_slot = 0, p_end = 0;
struct maple_node *old_parent, *new_parent, *left, *right;
p_end = ma_data_end_r64(&old_parent->mr64, UINT_MAX);
if (p_end >= MAPLE_RANGE64_SLOTS - 1) {
/* Must split the parent */
+ p_slot = mt_parent_slot(mas->node);
ma_encoded_parent(mas);
- p_slot = mt_parent_slot(enc_full);
split = ma_split(mas, p_slot, p_end, 1);
if (mas_is_err(mas))
return 0;
}
}
- enc_full = mas->node;
mas_node_cnt(mas, 3);
if (mas_is_err(mas))
return 0;
new_parent = ma_next_alloc(mas);
// Record the node type for the children types.
- ctype = mt_node_type(enc_full);
+ ctype = mt_node_type(mas->node);
// copy the data and calculate the split location.
split = ma_cp_data_64(mas, left, right, 0);
// Copy the parents information
if (!ma_is_root(full)) {
// Copy the parent data and leave a hole.
- p_slot = mt_parent_slot(enc_full);
+ p_slot = mt_parent_slot(mas->node);
MA_CP(cp, old_parent, new_parent, 0, p_slot);
ma_copy(mas, &cp);
cp.dst_start += 1;