From cd8eb8776e44f1fa7443551792c1dd8cd00c5db2 Mon Sep 17 00:00:00 2001 From: Stephen Williams Date: Tue, 3 Jul 2007 16:12:55 -0700 Subject: [PATCH] Fix comparison of two negative numbers Pairs of negative numbers that are equal do not set the LT flag correctly at runtime. --- vvp/vthread.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/vvp/vthread.cc b/vvp/vthread.cc index 53fb283b8..b9803289b 100644 --- a/vvp/vthread.cc +++ b/vvp/vthread.cc @@ -675,9 +675,9 @@ bool of_CMPS(vthread_t thr, vvp_code_t cp) sig1 = thr_get_bit(thr, end1); sig2 = thr_get_bit(thr, end2); - /* If both numbers are negative, then switch the - direction of the lt. */ - if ((sig1 == 1) && (sig2 == 1) && (eq != 0)) + /* If both numbers are negative (and not equal) then + switch the direction of the lt. */ + if ((sig1 == 1) && (sig2 == 1) && (eq != 1)) lt ^= 1; /* If the first is negative and the last positive, then