aboutsummaryrefslogtreecommitdiffstats
path: root/mpi/mpi-cmp.c
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>1999-01-07 17:05:48 +0000
committerWerner Koch <[email protected]>1999-01-07 17:05:48 +0000
commit7d0efec7cf5ae110c99511abc32587ff0c45b14f (patch)
treec25f43c0b175ca31c84da4e9a256b259ea070fc7 /mpi/mpi-cmp.c
parentSee ChangeLog: Sun Jan 3 15:28:44 CET 1999 Werner Koch (diff)
downloadgnupg-7d0efec7cf5ae110c99511abc32587ff0c45b14f.tar.gz
gnupg-7d0efec7cf5ae110c99511abc32587ff0c45b14f.zip
See ChangeLog: Thu Jan 7 18:00:58 CET 1999 Werner Koch
Diffstat (limited to 'mpi/mpi-cmp.c')
-rw-r--r--mpi/mpi-cmp.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/mpi/mpi-cmp.c b/mpi/mpi-cmp.c
index f4dd70e90..3c3c76b7c 100644
--- a/mpi/mpi-cmp.c
+++ b/mpi/mpi-cmp.c
@@ -46,27 +46,28 @@ mpi_cmp_ui( MPI u, unsigned long v )
int
mpi_cmp( MPI u, MPI v )
{
- mpi_size_t usize = u->nlimbs;
- mpi_size_t vsize = v->nlimbs;
+ mpi_size_t usize, vsize;
int cmp;
- /* FIXME: are the numbers always normalized? */
+ mpi_normalize( u );
+ mpi_normalize( v );
+ usize = u->nlimbs;
+ vsize = v->nlimbs;
if( !u->sign && v->sign )
return 1;
- else if( u->sign && !v->sign )
+ if( u->sign && !v->sign )
return -1;
- else if( usize != vsize && !u->sign && !v->sign )
+ if( usize != vsize && !u->sign && !v->sign )
return usize - vsize;
- else if( usize != vsize && u->sign && v->sign )
+ if( usize != vsize && u->sign && v->sign )
return vsize + usize;
- else if( !usize )
+ if( !usize )
return 0;
- else if( !(cmp=mpihelp_cmp( u->d, v->d, usize )) )
+ if( !(cmp=mpihelp_cmp( u->d, v->d, usize )) )
return 0;
- else if( (cmp < 0?1:0) == (u->sign?1:0))
+ if( (cmp < 0?1:0) == (u->sign?1:0))
return 1;
- else
- return -1;
+ return -1;
}