From 6ef92c5fc09356b4691e6f29c09162534d5ac489 Mon Sep 17 00:00:00 2001 From: James Cherry Date: Fri, 10 Apr 2026 10:35:36 -0700 Subject: [PATCH] LibertyPort::less Signed-off-by: James Cherry --- liberty/Liberty.cc | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/liberty/Liberty.cc b/liberty/Liberty.cc index ae375e21..1817a7a2 100644 --- a/liberty/Liberty.cc +++ b/liberty/Liberty.cc @@ -2477,18 +2477,10 @@ bool LibertyPort::less(const LibertyPort *port1, const LibertyPort *port2) { - if (port1 == nullptr && port2 != nullptr) - return true; - if (port1 != nullptr && port2 == nullptr) - return false; - const std::string &name1 = port1->name(); - const std::string &name2 = port2->name(); - if (name1 == name2) { - PortDirection *dir1 = port1->direction(); - PortDirection *dir2 = port2->direction(); - return dir1->index() < dir2->index(); - } - return name1 < name2; + if (port1 && port2) + return port1->pinIndex() < port2->pinIndex(); + else + return port1 == nullptr && port2 != nullptr; } void