From ab39366f7bf8e5aed951e81176357f1b06cd9956 Mon Sep 17 00:00:00 2001 From: James Cherry Date: Fri, 12 Sep 2025 09:10:03 -0700 Subject: [PATCH] tagStateCmp use +exceptionStateLess Signed-off-by: James Cherry --- include/sta/ExceptionPath.hh | 4 ++++ sdc/ExceptionPath.cc | 14 ++++++++++---- search/Tag.cc | 4 ++-- 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/include/sta/ExceptionPath.hh b/include/sta/ExceptionPath.hh index 1619fec3..eb089f5f 100644 --- a/include/sta/ExceptionPath.hh +++ b/include/sta/ExceptionPath.hh @@ -667,6 +667,10 @@ private: int index_; }; +bool +exceptionStateLess(const ExceptionState *state1, + const ExceptionState *state2); + // Exception thrown by check. class EmptyExpceptionPt : public Exception { diff --git a/sdc/ExceptionPath.cc b/sdc/ExceptionPath.cc index 22dfaf5e..06033d4c 100644 --- a/sdc/ExceptionPath.cc +++ b/sdc/ExceptionPath.cc @@ -2280,17 +2280,23 @@ ExceptionState::hash() const } bool -ExceptionStateLess::operator()(const ExceptionState *state1, - const ExceptionState *state2) const +exceptionStateLess(const ExceptionState *state1, + const ExceptionState *state2) { const ExceptionPath *except1 = state1->exception(); const ExceptionPath *except2 = state2->exception(); - return except1->id() < except2->id() - //return except1 < except2 + return except1->id() < except2->id() || (except1 == except2 && state1->index() < state2->index()); } +bool +ExceptionStateLess::operator()(const ExceptionState *state1, + const ExceptionState *state2) const +{ + return exceptionStateLess(state1, state2); +} + //////////////////////////////////////////////////////////////// ExceptionPathLess::ExceptionPathLess(const Network *network) : diff --git a/search/Tag.cc b/search/Tag.cc index 80578548..ca246ad8 100644 --- a/search/Tag.cc +++ b/search/Tag.cc @@ -571,9 +571,9 @@ tagStateCmp(const Tag *tag1, && state_iter2.hasNext()) { ExceptionState *state1 = state_iter1.next(); ExceptionState *state2 = state_iter2.next(); - if (state1 < state2) + if (exceptionStateLess(state1, state2)) return -1; - if (state1 > state2) + if (exceptionStateLess(state2, state1)) return 1; } return 0;