Lines Matching refs:branch
25 branch = branch->branches[!!(n)];
37 tree->branch = NULL; in phpdbg_btree_init()
43 phpdbg_btree_branch *branch = tree->branch; in phpdbg_btree_find() local
46 if (branch == NULL) { in phpdbg_btree_find()
52 if (branch->branches[1]) { in phpdbg_btree_find()
58 if (branch->branches[0]) { in phpdbg_btree_find()
66 return &branch->result; in phpdbg_btree_find()
70 phpdbg_btree_branch *branch = tree->branch; in phpdbg_btree_find_closest() local
73 if (branch == NULL) { in phpdbg_btree_find_closest()
80 if (branch->branches[0]) { in phpdbg_btree_find_closest()
90 branch = tree->branch; in phpdbg_btree_find_closest()
94 CHOOSE_BRANCH((idx >> i) % 2 == 1 && branch->branches[1]); in phpdbg_btree_find_closest()
100 CHOOSE_BRANCH(branch->branches[1]); in phpdbg_btree_find_closest()
106 if (branch->branches[1]) { in phpdbg_btree_find_closest()
107 if (branch->branches[0]) { in phpdbg_btree_find_closest()
114 CHOOSE_BRANCH(branch->branches[1]); in phpdbg_btree_find_closest()
121 return &branch->result; in phpdbg_btree_find_closest()
148 phpdbg_btree_branch **branch = &tree->branch; in phpdbg_btree_insert_or_update() local
151 if (*branch == NULL) { in phpdbg_btree_insert_or_update()
154 branch = &(*branch)->branches[(idx >> i) % 2]; in phpdbg_btree_insert_or_update()
157 if (*branch == NULL) { in phpdbg_btree_insert_or_update()
163 …phpdbg_btree_branch *memory = *branch = pemalloc((i + 2) * sizeof(phpdbg_btree_branch), tree->pers… in phpdbg_btree_insert_or_update()
165 (*branch)->branches[!((idx >> i) % 2)] = NULL; in phpdbg_btree_insert_or_update()
166 branch = &(*branch)->branches[(idx >> i) % 2]; in phpdbg_btree_insert_or_update()
167 *branch = ++memory; in phpdbg_btree_insert_or_update()
175 (*branch)->result.idx = idx; in phpdbg_btree_insert_or_update()
176 (*branch)->result.ptr = ptr; in phpdbg_btree_insert_or_update()
183 phpdbg_btree_branch *branch = tree->branch; in phpdbg_btree_delete() local
189 if (branch->branches[0] && branch->branches[1]) { in phpdbg_btree_delete()
190 last_dual_branch = branch; in phpdbg_btree_delete()
194 branch = branch->branches[(idx >> i) % 2]; in phpdbg_btree_delete()
197 if (branch == NULL) { in phpdbg_btree_delete()
205 pefree(tree->branch, tree->persistent); in phpdbg_btree_delete()
206 tree->branch = NULL; in phpdbg_btree_delete()
215 branch = last_dual_branch->branches[!last_dual_branch_branch]; in phpdbg_btree_delete()
217 …branch = (branch->branches[branch->branches[1] == ++original_branch] = last_dual_branch + i_last_d… in phpdbg_btree_delete()
229 void phpdbg_btree_clean_recursive(phpdbg_btree_branch *branch, zend_ulong depth, zend_bool persiste… in phpdbg_btree_clean_recursive() argument
230 phpdbg_btree_branch *start = branch; in phpdbg_btree_clean_recursive()
232 zend_bool use_branch = branch + 1 == branch->branches[0]; in phpdbg_btree_clean_recursive()
233 if (branch->branches[use_branch]) { in phpdbg_btree_clean_recursive()
234 phpdbg_btree_clean_recursive(branch->branches[use_branch], depth, persistent); in phpdbg_btree_clean_recursive()
242 if (tree->branch) { in phpdbg_btree_clean()
243 phpdbg_btree_clean_recursive(tree->branch, tree->depth, tree->persistent); in phpdbg_btree_clean()
244 tree->branch = NULL; in phpdbg_btree_clean()
249 void phpdbg_btree_branch_dump(phpdbg_btree_branch *branch, zend_ulong depth) { in phpdbg_btree_branch_dump() argument
250 if (branch) { in phpdbg_btree_branch_dump()
252 phpdbg_btree_branch_dump(branch->branches[0], depth); in phpdbg_btree_branch_dump()
253 phpdbg_btree_branch_dump(branch->branches[1], depth); in phpdbg_btree_branch_dump()
255 fprintf(stderr, "%p: %p\n", (void *) branch->result.idx, branch->result.ptr); in phpdbg_btree_branch_dump()
261 phpdbg_btree_branch_dump(tree->branch, tree->depth); in phpdbg_btree_dump()