start_piv = mas_safe_pivot(mas, offset);
restart_next_node:
level = 0;
+
+ascend_again:
do {
if (mte_is_root(mas->node))
goto no_entry;
prev_piv = mas_safe_pivot(mas, offset);
if (prev_piv > max)
goto no_entry;
-
} while (prev_piv == mas->max);
- ++offset;
+ if (++offset >= mt_slots[mt])
+ goto ascend_again;
+
+ if (!mas_slot(mas, slots, offset)) // beyond the end of data
+ goto ascend_again;
+
pivot = mas_safe_pivot(mas, offset);
// Descend, if necessary.
while (level > 1) {
mas_start(mas);
entry = mas_range_load(mas, range_start, &range_max);
mas->last = range_max;
+ if (entry)
+ return entry;
}
- if (entry)
- return entry;
-
return __mas_next(mas, limit, range_start);
}