Mercurial > hg > Gears > Gears
changeset 1069:a5f0b0f47edb
rollback
author | matac42 <matac@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Mon, 05 Feb 2024 01:47:57 +0900 |
parents | 1740802ab0af |
children | fba66b75a7dc |
files | src/parallel_execution/RedBlackTree.cbc |
diffstat | 1 files changed, 10 insertions(+), 15 deletions(-) [+] |
line wrap: on
line diff
--- a/src/parallel_execution/RedBlackTree.cbc Sun Feb 04 21:58:23 2024 +0900 +++ b/src/parallel_execution/RedBlackTree.cbc Mon Feb 05 01:47:57 2024 +0900 @@ -203,6 +203,10 @@ __code rightDown1(struct RedBlackTree* tree, struct Stack* stack) { printf("rightDown1\n"); + if (tree->current == NULL) { + goto swap(); + } + if (tree->current->right == NULL) { goto up(); } @@ -263,7 +267,9 @@ tree->current = data; if (tree->current == NULL) { - // ここでpopしなければ5は治るが...... + goto swap(tree); + } + if (tree->current == tree->root) { goto swap(tree); } @@ -278,23 +284,12 @@ if (tree->current->right) { // toStackのtopにrightがあればup(すでにコピー済みなので) // それがNULLならup3(rightDown)(そこからupしてきたのでNULLであるということはまだコピーできていないということになる(leftからのupをしたということ)) - goto up2_0(tree); + goto up4(tree); } - if (tree->current == tree->root) { - goto swap(tree); - } - goto toStack->pop(up); } -__code up2_0(struct RedBlackTree* tree) { - printf("up2_0\n"); - struct Stack* toStack = tree->toStack; - - goto up4(tree); -} - __code up4(struct RedBlackTree* tree) { printf("up4\n"); struct Stack* toStack = tree->toStack; @@ -307,7 +302,7 @@ struct Node* toTree = (Node*)(stack->data); if (toTree->right) { - goto swap(tree); + goto up(tree); } else { goto up3(tree); } @@ -333,7 +328,7 @@ __code swap1(struct RedBlackTree* tree) { printf("swap1\n"); struct Stack* toStack = tree->toStack; - goto toStack->get(swap2); + goto toStack->pop(swap2); } __code swap2(struct RedBlackTree* tree, struct Stack* stack, __code next(...)) {