From 423ae6bc9e23772512a81909ae303389a3e3cedb Mon Sep 17 00:00:00 2001 From: "yu.dongliang" <18588496441@163.com> Date: Thu, 27 Jul 2023 22:39:21 +0800 Subject: [PATCH] _ses_path_cmp() --- ses_step_topo.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/ses_step_topo.c b/ses_step_topo.c index 0843179..8334256 100644 --- a/ses_step_topo.c +++ b/ses_step_topo.c @@ -1,5 +1,19 @@ #include"ses_core.h" +static int _ses_path_cmp(const void* v0, const void* v1) +{ + const ses_path_t* p0 = *(const ses_path_t**)v0; + const ses_path_t* p1 = *(const ses_path_t**)v1; + + if (p0->pins->size > p1->pins->size) + return -1; + + if (p0->pins->size < p1->pins->size) + return 1; + + return 0; +} + static int __dfs_path(ScfEfunction* f, ScfEcomponent* rc, ScfEpin* rp, ses_ctx_t* ctx, ses_path_t** ppath) { ScfEcomponent* c; @@ -215,6 +229,8 @@ static int _topo_handler(ScfEfunction* f, int64_t ns, int64_t count, ses_ctx_t* path = NULL; } + scf_vector_qsort(ctx->paths, _ses_path_cmp); + #if 1 for (i = 0; i < ctx->paths->size; i++) { path = ctx->paths->data[i]; -- 2.25.1