mirror of
https://github.com/danog/phpseclib.git
synced 2024-11-30 04:39:21 +01:00
Merge branch '1.0' into 2.0
This commit is contained in:
commit
fae6542efc
@ -2694,7 +2694,14 @@ class BigInteger
|
||||
{
|
||||
switch (MATH_BIGINTEGER_MODE) {
|
||||
case self::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 self::MODE_BCMATH:
|
||||
return bccomp($this->value, $y->value, 0);
|
||||
}
|
||||
|
@ -182,6 +182,9 @@ abstract class Unit_Math_BigInteger_TestCase extends PhpseclibTestCase
|
||||
// c < d
|
||||
$this->assertLessThan(0, $c->compare($d));
|
||||
$this->assertGreaterThan(0, $d->compare($c));
|
||||
|
||||
$this->assertSame(-1, $this->getInstance(-999)->compare($this->getInstance(370)));
|
||||
$this->assertSame(1, $this->getInstance(999)->compare($this->getInstance(-700)));
|
||||
}
|
||||
|
||||
public function testBitwiseAND()
|
||||
|
Loading…
Reference in New Issue
Block a user