summaryrefslogtreecommitdiffstats
path: root/lib/mpi/mpi-cmp.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/mpi/mpi-cmp.c')
-rw-r--r--lib/mpi/mpi-cmp.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/lib/mpi/mpi-cmp.c b/lib/mpi/mpi-cmp.c
index 1871e7b61ca0..8ed36b8cbe02 100644
--- a/lib/mpi/mpi-cmp.c
+++ b/lib/mpi/mpi-cmp.c
@@ -61,10 +61,8 @@ int mpi_cmp(MPI u, MPI v)
if (!usize)
return 0;
cmp = mpihelp_cmp(u->d, v->d, usize);
- if (!cmp)
- return 0;
- if ((cmp < 0 ? 1 : 0) == (u->sign ? 1 : 0))
- return 1;
- return -1;
+ if (u->sign)
+ return -cmp;
+ return cmp;
}
EXPORT_SYMBOL_GPL(mpi_cmp);
OpenPOWER on IntegriCloud