From 0c8f73ba8b83604463f26eca51f9c8278e791879 Mon Sep 17 00:00:00 2001
From: Paul Bakker
Date: Thu, 22 Mar 2012 14:08:57 +0000
Subject: [PATCH] - Fixed a mistake in mpi_cmp_mpi() where longer B values are
handled wrong
---
library/bignum.c | 2 +-
tests/suites/test_suite_mpi.data | 9 +++++++++
2 files changed, 10 insertions(+), 1 deletion(-)
diff --git a/library/bignum.c b/library/bignum.c
index eccb9d30f..b2213127a 100644
--- a/library/bignum.c
+++ b/library/bignum.c
@@ -687,7 +687,7 @@ int mpi_cmp_mpi( const mpi *X, const mpi *Y )
return( 0 );
if( i > j ) return( X->s );
- if( j > i ) return( -X->s );
+ if( j > i ) return( -Y->s );
if( X->s > 0 && Y->s < 0 ) return( 1 );
if( Y->s > 0 && X->s < 0 ) return( -1 );
diff --git a/tests/suites/test_suite_mpi.data b/tests/suites/test_suite_mpi.data
index 0a8c10332..089c7477e 100644
--- a/tests/suites/test_suite_mpi.data
+++ b/tests/suites/test_suite_mpi.data
@@ -138,6 +138,15 @@ mpi_cmp_mpi:10:"-2":10:"-3":1
Base test mpi_cmp_mpi (Negative values) #3
mpi_cmp_mpi:10:"-2":10:"-1":-1
+Base test mpi_cmp_mpi (Mixed values) #4
+mpi_cmp_mpi:10:"-3":10:"2":-1
+
+Base test mpi_cmp_mpi (Mixed values) #5
+mpi_cmp_mpi:10:"2":10:"-3":1
+
+Base test mpi_cmp_mpi (Mixed values) #6
+mpi_cmp_mpi:10:"-2":10:"31231231289798":-1
+
Base test mpi_cmp_abs #1
mpi_cmp_abs:10:"693":10:"693":0