]> git.baikalelectronics.ru Git - kernel.git/commit
MPILIB: Deobfuscate mpi_cmp
authorRasmus Villemoes <linux@rasmusvillemoes.dk>
Wed, 14 Jan 2015 15:15:57 +0000 (15:15 +0000)
committerDavid Howells <dhowells@redhat.com>
Wed, 14 Jan 2015 15:15:57 +0000 (15:15 +0000)
commit5f6978a93adf6b62812b0a2eed61e678d7131e04
treebbc85cda5a693a759053a999c5a6f22e57c0c4ca
parent3b98d0010bb45bc8a9251474e5f0aed397d45bf1
MPILIB: Deobfuscate mpi_cmp

The condition preceding 'return 1;' makes my head hurt. At this point,
we know that u and v have the same sign; if they are negative, they
compare opposite to how their absolute values compare (which
mpihelp_cmp found for us), otherwise cmp itself is the
answer. Negating cmp is ok since mpihelp_cmp returns {-1,0,1};
-INT_MIN==INT_MIN won't bite us.

Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Signed-off-by: David Howells <dhowells@redhat.com>
Acked-by: Dmitry Kasatkin <dmitry.kasatkin@gmail.com>
lib/mpi/mpi-cmp.c