Mercurial > hg > Members > Moririn
changeset 426:02313bbfe900
fix RedBlackTree.cbc
author | mir3636 |
---|---|
date | Fri, 06 Oct 2017 19:48:42 +0900 |
parents | ea6353b6c4ef |
children | 07ccd411ad70 |
files | src/parallel_execution/RedBlackTree.cbc |
diffstat | 1 files changed, 17 insertions(+), 19 deletions(-) [+] |
line wrap: on
line diff
--- a/src/parallel_execution/RedBlackTree.cbc Fri Oct 06 19:00:26 2017 +0900 +++ b/src/parallel_execution/RedBlackTree.cbc Fri Oct 06 19:48:42 2017 +0900 @@ -45,12 +45,12 @@ if (root) { tree->current = root; tree->result = compare(tree->current, node); - goto replaceNode(); + goto findNode(tree); } - goto insertNode(); + goto insertNode(tree, node); } -__code replaceNode(struct RedBlackTree* tree) { +__code findNode(struct RedBlackTree* tree) { struct Stack* nodeStack = tree->nodeStack; struct Node* oldNode = tree->current; struct Node* newNode = tree->newNode; @@ -59,7 +59,7 @@ goto nodeStack->push(newNode, replaceNode1); } -__code replaceNode1(struct RedBlackTree* tree, struct Node* node, __code next(...)) { +__code findNode1(struct RedBlackTree* tree, struct Node* node, __code next(...)) { struct Node* oldNode = tree->current; struct Node* newNode = tree->previous; struct Node* newnewNode = &ALLOCATE(context, Node)->Node; @@ -78,9 +78,9 @@ tree->newNode = newnewNode; if (tree->current) { tree->result = compare(tree->current, node); - goto replaceNode(); + goto findNode(tree); } - goto insertNode(); + goto insertNode(tree, node); } @@ -97,7 +97,7 @@ if (parent != NULL) { tree->parent = parent; tree->grandparent = grandparent; - goto insertCase2(); + goto insertCase2(tree); } tree->root->color = Black; goto stackClear(); @@ -114,10 +114,10 @@ if (tree->parent->color == Black) { goto stackClear(); } - goto insertCase3(); + goto insertCase3(tree); } -__code insertCase3(struct RedBlackTree* tree, struct Stack* nodeStack) { +__code insertCase3(struct RedBlackTree* tree) { struct Stack* nodeStack = tree->nodeStack; struct Node* uncle; @@ -195,15 +195,14 @@ grandparent); } -__code rotateLeft(struct RedBlackTree* tree, struct Stack* nodeStack) { - nodeStack->stack = (union Data*)tree->nodeStack; - nodeStack->next = C_rotateLeft1; - goto meta(context, tree->nodeStack->get); +__code rotateLeft(struct RedBlackTree* tree) { + struct Stack* nodeStack = tree->nodeStack; + goto nodeStack->get(rotateLeft1); } __code rotateLeft_stub(struct Context* context) { struct RedBlackTree* traverse = context->data[D_RotateTree]->RotateTree.traverse; - goto rotateLeft(context, traverse, Gearef(context, Stack)); + goto rotateLeft(context, traverse); } __code rotateLeft1(struct Node* node, struct RedBlackTree* tree, struct Node* parent, struct RotateTree* rotateTree) { @@ -235,15 +234,14 @@ Gearef(context, RotateTree)); } -__code rotateRight(struct RedBlackTree* tree, struct Stack* nodeStack) { - nodeStack->stack = (union Data*)tree->nodeStack; - nodeStack->next = C_rotateRight1; - goto meta(context, tree->nodeStack->get); +__code rotateRight(struct RedBlackTree* tree) { + struct Stack* nodeStack = tree->nodeStack; + goto nodeStack->get(rotateRight1); } __code rotateRight_stub(struct Context* context) { struct RedBlackTree* traverse = context->data[D_RotateTree]->RotateTree.traverse; - goto rotateLeft(context, traverse, Gearef(context, Stack)); + goto rotateLeft(context, traverse); } __code rotateRight1(struct Node* node, struct RedBlackTree* traverse,struct Node *parent,struct RotateTree *rotateTree) {