Lines Matching refs:n
12 #define CHECK(n) /**/ argument
21 static struct rbnode *get_child(struct rbnode *n, uint8_t side) in get_child() argument
23 CHECK(n); in get_child()
25 return n->children[1]; in get_child()
28 uintptr_t l = (uintptr_t) n->children[0]; in get_child()
34 static void set_child(struct rbnode *n, uint8_t side, void *val) in set_child() argument
36 CHECK(n); in set_child()
38 n->children[1] = val; in set_child()
40 uintptr_t old = (uintptr_t) n->children[0]; in set_child()
43 n->children[0] = (void *) (new | (old & 1UL)); in set_child()
47 static enum rb_color get_color(struct rbnode *n) in get_color() argument
49 CHECK(n); in get_color()
50 return ((uintptr_t)n->children[0]) & 1UL; in get_color()
53 static bool is_black(struct rbnode *n) in is_black() argument
55 return get_color(n) == BLACK; in is_black()
58 static bool is_red(struct rbnode *n) in is_red() argument
60 return get_color(n) == RED; in is_red()
63 static void set_color(struct rbnode *n, enum rb_color color) in set_color() argument
65 CHECK(n); in set_color()
67 uintptr_t *p = (void *) &n->children[0]; in set_color()
104 struct rbnode *n; in z_rb_get_minmax() local
106 for (n = tree->root; (n != NULL) && (get_child(n, side) != NULL); in z_rb_get_minmax()
107 n = get_child(n, side)) { in z_rb_get_minmax()
110 return n; in z_rb_get_minmax()
275 struct rbnode *n = stack[stacksz - 1]; in fix_missing_black() local
277 uint8_t n_side = get_side(parent, n); in fix_missing_black()
281 CHECK(is_black(n)); in fix_missing_black()
293 stack[stacksz] = n; in fix_missing_black()
309 if (n == null_node) { in fix_missing_black()
351 stack[stacksz - 2] = n; in fix_missing_black()
365 if (n == null_node) { in fix_missing_black()
526 struct rbnode *n = tree->root; in rb_contains() local
528 while ((n != NULL) && (n != node)) { in rb_contains()
529 n = get_child(n, tree->lessthan_fn(n, node)); in rb_contains()
532 return n == node; in rb_contains()
540 static inline struct rbnode *stack_left_limb(struct rbnode *n, in stack_left_limb() argument
544 f->stack[f->top] = n; in stack_left_limb()
547 for (n = get_child(n, 0U); n != NULL; n = get_child(n, 0U)) { in stack_left_limb()
549 f->stack[f->top] = n; in stack_left_limb()
566 struct rbnode *n; in z_rb_foreach_next() local
582 n = get_child(f->stack[f->top], 1U); in z_rb_foreach_next()
583 if (n != NULL) { in z_rb_foreach_next()
584 return stack_left_limb(n, f); in z_rb_foreach_next()