summaryrefslogtreecommitdiff
path: root/lib/mpi/mpi-cmp.c
diff options
context:
space:
mode:
authorIngo Molnar <mingo@kernel.org>2015-03-04 22:00:05 +0300
committerIngo Molnar <mingo@kernel.org>2015-03-04 22:00:05 +0300
commit0bbdb4258bd116d8cd5d209e8d5b29bae516e5b3 (patch)
treec607302701f7a7942f2e76391fdb406ec86628d5 /lib/mpi/mpi-cmp.c
parentbd624d75db21ea5402f9ecf4450b311794d80352 (diff)
parent13a7a6ac0a11197edcd0f756a035f472b42cdf8b (diff)
downloadlinux-0bbdb4258bd116d8cd5d209e8d5b29bae516e5b3.tar.xz
Merge tag 'v4.0-rc2' into timers/core, to refresh the tree before pulling more changes
Diffstat (limited to 'lib/mpi/mpi-cmp.c')
-rw-r--r--lib/mpi/mpi-cmp.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/lib/mpi/mpi-cmp.c b/lib/mpi/mpi-cmp.c
index 1871e7b61ca0..d25e9e96c310 100644
--- a/lib/mpi/mpi-cmp.c
+++ b/lib/mpi/mpi-cmp.c
@@ -57,14 +57,12 @@ int mpi_cmp(MPI u, MPI v)
if (usize != vsize && !u->sign && !v->sign)
return usize - vsize;
if (usize != vsize && u->sign && v->sign)
- return vsize + usize;
+ return vsize - usize;
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);