mirror of
https://github.com/phpseclib/phpseclib.git
synced 2024-12-28 12:10:59 +00:00
BigInteger: GMP engine didn't always return 1 or -1
This commit is contained in:
parent
c839297065
commit
64542e699f
@ -296,7 +296,14 @@ class GMP extends Engine
|
|||||||
*/
|
*/
|
||||||
public function compare(GMP $y)
|
public function compare(GMP $y)
|
||||||
{
|
{
|
||||||
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user