return entry;
}
-static inline void mas_bfs_preorder(struct ma_state *mas)
-{
-
- if (mas_is_start(mas)) {
- mas_start(mas);
- return;
- }
-
- if (mte_is_leaf(mas->node) && mte_is_root(mas->node)) {
- mas->node = MAS_NONE;
- return;
- }
-
-}
-
-/* mas limits not adjusted */
-static inline void mas_dfs_preorder(struct ma_state *mas)
-{
-
- struct maple_enode *prev;
- unsigned char slot = 0;
-
- if (mas_is_start(mas)) {
- mas_start(mas);
- return;
- }
-
- if (mte_is_leaf(mas->node) && mte_is_root(mas->node))
- goto done;
-
-walk_up:
- if (mte_is_leaf(mas->node) ||
- (slot >= mt_slot_count(mas->node))) {
- if (mte_is_root(mas->node))
- goto done;
-
- slot = mte_parent_slot(mas->node) + 1;
- mas->node = mt_mk_node(mte_parent(mas->node),
- mas_parent_enum(mas, mas->node));
- goto walk_up;
- }
-
- prev = mas->node;
- mas->node = mas_get_slot(mas, slot);
- if (!mas->node) {
- if (mte_is_root(prev))
- goto done;
-
- mas->node = prev;
- slot = mte_parent_slot(mas->node) + 1;
- mas->node = mt_mk_node(mte_parent(mas->node),
- mas_parent_enum(mas, mas->node));
- goto walk_up;
- }
-
- return;
-done:
- mas->node = MAS_NONE;
-}
-
static inline unsigned char mas_dead_leaves(struct ma_state *mas, void **slots)
{
struct maple_node *node;
#else // __KERNEL__ is defined.
#define MA_PTR "%px"
#endif
+/* mas limits not adjusted */
+static inline void mas_dfs_preorder(struct ma_state *mas)
+{
+
+ struct maple_enode *prev;
+ unsigned char slot = 0;
+
+ if (mas_is_start(mas)) {
+ mas_start(mas);
+ return;
+ }
+
+ if (mte_is_leaf(mas->node) && mte_is_root(mas->node))
+ goto done;
+
+walk_up:
+ if (mte_is_leaf(mas->node) ||
+ (slot >= mt_slot_count(mas->node))) {
+ if (mte_is_root(mas->node))
+ goto done;
+
+ slot = mte_parent_slot(mas->node) + 1;
+ mas->node = mt_mk_node(mte_parent(mas->node),
+ mas_parent_enum(mas, mas->node));
+ goto walk_up;
+ }
+
+ prev = mas->node;
+ mas->node = mas_get_slot(mas, slot);
+ if (!mas->node) {
+ if (mte_is_root(prev))
+ goto done;
+
+ mas->node = prev;
+ slot = mte_parent_slot(mas->node) + 1;
+ mas->node = mt_mk_node(mte_parent(mas->node),
+ mas_parent_enum(mas, mas->node));
+ goto walk_up;
+ }
+
+ return;
+done:
+ mas->node = MAS_NONE;
+}
+
+
+static inline void mas_bfs_preorder(struct ma_state *mas)
+{
+
+ if (mas_is_start(mas)) {
+ mas_start(mas);
+ return;
+ }
+
+ if (mte_is_leaf(mas->node) && mte_is_root(mas->node)) {
+ mas->node = MAS_NONE;
+ return;
+ }
+
+}
+
+/* Depth first search, post-order */
+static inline void mas_dfs_postorder(struct ma_state *mas, unsigned long max)
+{
+
+ struct maple_enode *p = MAS_NONE, *mn = mas->node;
+ unsigned long p_min, p_max;
+
+ mas_next_node(mas, max);
+ if (!mas_is_none(mas))
+ return;
+
+ if (mte_is_root(mn))
+ return;
+
+ mas->node = mn;
+ mas_ascend(mas);
+ while (mas->node != MAS_NONE) {
+ p = mas->node;
+ p_min = mas->min;
+ p_max = mas->max;
+ mas_prev_node(mas, 0);
+ }
+
+ if (p == MAS_NONE)
+ return;
+
+ mas->node = p;
+ mas->max = p_max;
+ mas->min = p_min;
+}
+
// Tree validations
void mt_dump_node(void *entry, unsigned long min, unsigned long max,
unsigned int depth);
}
}
-/* Depth first search, post-order */
-static inline void mas_dfs_postorder(struct ma_state *mas, unsigned long max)
-{
-
- struct maple_enode *p = MAS_NONE, *mn = mas->node;
- unsigned long p_min, p_max;
-
- mas_next_node(mas, max);
- if (!mas_is_none(mas))
- return;
-
- if (mte_is_root(mn))
- return;
-
- mas->node = mn;
- mas_ascend(mas);
- while (mas->node != MAS_NONE) {
- p = mas->node;
- p_min = mas->min;
- p_max = mas->max;
- mas_prev_node(mas, 0);
- }
-
- if (p == MAS_NONE)
- return;
-
- mas->node = p;
- mas->max = p_max;
- mas->min = p_min;
-}
-
void mt_validate_nulls(struct maple_tree *mt)
{
void *entry, *last = (void *)1;