From e75e7131ac0b10c3a84c786a8bbe62a9c9d6087b Mon Sep 17 00:00:00 2001 From: Stephen Williams Date: Mon, 2 Jul 2007 21:33:05 -0700 Subject: [PATCH] Fix signed compare with minus values If the operands were negative, and not equal, the lt flag would be set incorrectly. Signed-off-by: Stephen Williams --- vvp/vthread.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/vvp/vthread.cc b/vvp/vthread.cc index 046123471..a7fddbc43 100644 --- a/vvp/vthread.cc +++ b/vvp/vthread.cc @@ -868,9 +868,9 @@ bool of_CMPS(vthread_t thr, vvp_code_t cp) /* Correct the lt bit to account for the sign of the parameters. */ if (lt != BIT4_X) { - /* If both numbers are negative, then switch the - direction of the lt. */ - if ((sig1 == BIT4_1) && (sig2 == BIT4_1) && (eq != BIT4_0)) + /* If both numbers are negative (and not equal) then + switch the direction of the lt. */ + if ((sig1 == BIT4_1) && (sig2 == BIT4_1) && (eq != BIT4_1)) lt = ~lt; /* If the first is negative and the last positive, then