Merge branch '1.0' into 2.0

This commit is contained in:
terrafrost 2019-05-26 12:17:27 -05:00
commit fae6542efc
2 changed files with 11 additions and 1 deletions

View File

@ -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);
}

View File

@ -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()