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