Lines Matching refs:branch
23 branch = branch->branches[!!(n)];
35 tree->branch = NULL; in phpdbg_btree_init()
41 phpdbg_btree_branch *branch = tree->branch; in phpdbg_btree_find() local
44 if (branch == NULL) { in phpdbg_btree_find()
50 if (branch->branches[1]) { in phpdbg_btree_find()
56 if (branch->branches[0]) { in phpdbg_btree_find()
64 return &branch->result; in phpdbg_btree_find()
68 phpdbg_btree_branch *branch = tree->branch; in phpdbg_btree_find_closest() local
71 if (branch == NULL) { in phpdbg_btree_find_closest()
78 if (branch->branches[0]) { in phpdbg_btree_find_closest()
88 branch = tree->branch; in phpdbg_btree_find_closest()
92 CHOOSE_BRANCH((idx >> i) % 2 == 1 && branch->branches[1]); in phpdbg_btree_find_closest()
98 CHOOSE_BRANCH(branch->branches[1]); in phpdbg_btree_find_closest()
104 if (branch->branches[1]) { in phpdbg_btree_find_closest()
105 if (branch->branches[0]) { in phpdbg_btree_find_closest()
112 CHOOSE_BRANCH(branch->branches[1]); in phpdbg_btree_find_closest()
119 return &branch->result; in phpdbg_btree_find_closest()
146 phpdbg_btree_branch **branch = &tree->branch; in phpdbg_btree_insert_or_update() local
149 if (*branch == NULL) { in phpdbg_btree_insert_or_update()
152 branch = &(*branch)->branches[(idx >> i) % 2]; in phpdbg_btree_insert_or_update()
155 if (*branch == NULL) { in phpdbg_btree_insert_or_update()
161 …phpdbg_btree_branch *memory = *branch = pemalloc((i + 2) * sizeof(phpdbg_btree_branch), tree->pers… in phpdbg_btree_insert_or_update()
163 (*branch)->branches[!((idx >> i) % 2)] = NULL; in phpdbg_btree_insert_or_update()
164 branch = &(*branch)->branches[(idx >> i) % 2]; in phpdbg_btree_insert_or_update()
165 *branch = ++memory; in phpdbg_btree_insert_or_update()
173 (*branch)->result.idx = idx; in phpdbg_btree_insert_or_update()
174 (*branch)->result.ptr = ptr; in phpdbg_btree_insert_or_update()
181 phpdbg_btree_branch *branch = tree->branch; in phpdbg_btree_delete() local
187 if (branch->branches[0] && branch->branches[1]) { in phpdbg_btree_delete()
188 last_dual_branch = branch; in phpdbg_btree_delete()
192 branch = branch->branches[(idx >> i) % 2]; in phpdbg_btree_delete()
195 if (branch == NULL) { in phpdbg_btree_delete()
203 pefree(tree->branch, tree->persistent); in phpdbg_btree_delete()
204 tree->branch = NULL; in phpdbg_btree_delete()
213 branch = last_dual_branch->branches[!last_dual_branch_branch]; in phpdbg_btree_delete()
215 …branch = (branch->branches[branch->branches[1] == ++original_branch] = last_dual_branch + i_last_d… in phpdbg_btree_delete()
227 void phpdbg_btree_clean_recursive(phpdbg_btree_branch *branch, zend_ulong depth, bool persistent) { in phpdbg_btree_clean_recursive() argument
228 phpdbg_btree_branch *start = branch; in phpdbg_btree_clean_recursive()
230 bool use_branch = branch + 1 == branch->branches[0]; in phpdbg_btree_clean_recursive()
231 if (branch->branches[use_branch]) { in phpdbg_btree_clean_recursive()
232 phpdbg_btree_clean_recursive(branch->branches[use_branch], depth, persistent); in phpdbg_btree_clean_recursive()
240 if (tree->branch) { in phpdbg_btree_clean()
241 phpdbg_btree_clean_recursive(tree->branch, tree->depth, tree->persistent); in phpdbg_btree_clean()
242 tree->branch = NULL; in phpdbg_btree_clean()
247 void phpdbg_btree_branch_dump(phpdbg_btree_branch *branch, zend_ulong depth) { in phpdbg_btree_branch_dump() argument
248 if (branch) { in phpdbg_btree_branch_dump()
250 phpdbg_btree_branch_dump(branch->branches[0], depth); in phpdbg_btree_branch_dump()
251 phpdbg_btree_branch_dump(branch->branches[1], depth); in phpdbg_btree_branch_dump()
253 fprintf(stderr, "%p: %p\n", (void *) branch->result.idx, branch->result.ptr); in phpdbg_btree_branch_dump()
259 phpdbg_btree_branch_dump(tree->branch, tree->depth); in phpdbg_btree_dump()