bc: fix comparison bug, closes 12336

function                                             old     new   delta
bc_num_cmp                                           249     259     +10

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
Denys Vlasenko
2019-11-23 17:25:21 +01:00
parent d3539be8f2
commit 008413754b
2 changed files with 9 additions and 1 deletions

View File

@ -1465,7 +1465,10 @@ static ssize_t bc_num_cmp(BcNum *a, BcNum *b)
b_int = BC_NUM_INT(b);
a_int -= b_int;
if (a_int != 0) return (ssize_t) a_int;
if (a_int != 0) {
if (neg) return - (ssize_t) a_int;
return (ssize_t) a_int;
}
a_max = (a->rdx > b->rdx);
if (a_max) {