From 8535bcd23fffb0dd9a35d663d59a58ca2552ccea Mon Sep 17 00:00:00 2001 From: "yu.dongliang" <18588496441@163.com> Date: Wed, 8 Nov 2023 16:33:33 +0800 Subject: [PATCH] Revert "__ses_de_cross()" This reverts commit 37503abf9de184e19f89b7997147324c16dd6ec0. --- ses_layout.c | 31 +++++++++++-------------------- 1 file changed, 11 insertions(+), 20 deletions(-) diff --git a/ses_layout.c b/ses_layout.c index ffb4c18..708ba98 100644 --- a/ses_layout.c +++ b/ses_layout.c @@ -1048,7 +1048,7 @@ next: return 0; } -static int __ses_de_cross(ScfEfunction* f, int d, intptr_t N) +static int __ses_de_cross(ScfEfunction* f, int d) { ScfEcomponent* c; ScfEline* el; @@ -1070,6 +1070,7 @@ static int __ses_de_cross(ScfEfunction* f, int d, intptr_t N) return -ENOMEM; } + intptr_t N = 2; intptr_t i; intptr_t j; intptr_t k; @@ -1078,15 +1079,13 @@ static int __ses_de_cross(ScfEfunction* f, int d, intptr_t N) if (ret < 0) return ret; - if (N <= 0) { - if (0 < graph->size) { - v = graph->data[0]; - N = v->edges->size; - } else - N = 2; + if (0 < graph->size) { + v = graph->data[0]; + + N = v->edges->size; } - for (j = N; j >= 2; j--) { + for (j = N; j >= 1; j--) { for (i = 1; i <= j; i++) scf_vector_add(colors, (void*)i); @@ -1099,7 +1098,7 @@ static int __ses_de_cross(ScfEfunction* f, int d, intptr_t N) for (i = 0; i < graph->size; i++) { v = graph->data[i]; - if (v->color < 0 && j > 2) { + if (v->color < 0) { c = v->data; scf_loge("j: %ld, i: %ld, c%ld->color: %ld\n", j, i, c->id, v->color); break; @@ -1112,18 +1111,10 @@ static int __ses_de_cross(ScfEfunction* f, int d, intptr_t N) for (i = 0; i < graph->size; i++) { v = graph->data[i]; - c = v->data; - if (v->color > 0) { - c->color = v->color; - scf_logi("j: %ld, i: %ld, c%ld->color: %ld\n", j, i, c->id, c->color); - } else { - c->color = j; - scf_loge("j: %ld, i: %ld, c%ld->color: %ld\n", j, i, c->id, c->color); - } - + c = v->data; + c->color = v->color; v->color = 0; } - printf("\n"); scf_vector_clear(colors, NULL); } @@ -1484,7 +1475,7 @@ int ses_layout_function(ScfEfunction* f, int d) qsort(f->elines, f->n_elines, sizeof(ScfEline*), eline_cmp_id); - ret = __ses_de_cross(f, d, 0); + ret = __ses_de_cross(f, d); if (ret < 0) return ret; -- 2.25.1