}
/*
- * mas_data_end() - Find the end of the data (slot). Sets the value of the
- * last pivot to @last_piv.
+ * mas_data_end() - Find the end of the data (slot).
*
* @mas - the maple state
* @type - the type of maple node
- * @last_piv - the final pivot in this node.
*/
-static inline unsigned char _mas_data_end(const struct ma_state *mas,
- const enum maple_type type, unsigned long *last_piv)
+static inline unsigned char mas_data_end(const struct ma_state *mas)
+
{
int slot = 0;
- unsigned long piv = mas->min, prev_piv = mas->min;
+ enum maple_type type = mte_node_type(mas->node);
+ unsigned long piv = mas->min;
- for (; slot < mt_slot_count(mas->node); slot++) {
+ for (; slot < mt_slots[type]; slot++) {
piv = _mas_get_safe_pivot(mas, slot, type);
if (piv >= mas->max)
break;
if (!piv && slot) {
- piv = prev_piv;
slot--;
break;
}
- prev_piv = piv;
}
- *last_piv = piv;
return slot;
}
-static inline unsigned char mas_data_end(const struct ma_state *mas)
-{
- unsigned long l;
-
- return _mas_data_end(mas, mte_node_type(mas->node), &l);
-}
/*
* mas_leaf_max_gap() - Returns the largest gap in a leaf node
*
*/
static inline void mas_prev_node(struct ma_state *mas, unsigned long limit)
{
- unsigned long pivot, start_piv, last_pivot, min;
+ unsigned long pivot, start_piv, min;
int slot = mas_offset(mas);
struct maple_enode *mn;
int level;
mas->node = mn;
mas->max = pivot;
mas->min = min;
- slot = _mas_data_end(mas, mte_node_type(mn),
- &last_pivot) + 1;
+ slot = mas_data_end(mas) + 1;
} while (slot-- > 0);
ascend:
goto ascend;
mas->node = next;
- slot = _mas_data_end(mas, mte_node_type(next), &max);
+ slot = mas_data_end(mas);
+ max = mas_get_safe_pivot(mas, slot);
}
mas_set_offset(mas, slot);