mirror of
https://github.com/phpseclib/phpseclib.git
synced 2024-11-16 18:25:13 +00:00
BigInteger: GMP engine didn't always return 1 or -1
This commit is contained in:
parent
ade48c2cb1
commit
8b76e96b83
@ -2727,7 +2727,14 @@ class Math_BigInteger
|
|||||||
{
|
{
|
||||||
switch (MATH_BIGINTEGER_MODE) {
|
switch (MATH_BIGINTEGER_MODE) {
|
||||||
case MATH_BIGINTEGER_MODE_GMP:
|
case MATH_BIGINTEGER_MODE_GMP:
|
||||||
return gmp_cmp($this->value, $y->value);
|
$r = gmp_cmp($this->value, $y->value);
|
||||||
|
if ($r < -1) {
|
||||||
|
$r = -1;
|
||||||
|
}
|
||||||
|
if ($r > 1) {
|
||||||
|
$r = 1;
|
||||||
|
}
|
||||||
|
return $r;
|
||||||
case MATH_BIGINTEGER_MODE_BCMATH:
|
case MATH_BIGINTEGER_MODE_BCMATH:
|
||||||
return bccomp($this->value, $y->value, 0);
|
return bccomp($this->value, $y->value, 0);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user