mirror of
https://github.com/phpseclib/phpseclib.git
synced 2024-12-27 11:52:48 +00:00
Merge branch '2.0'
This commit is contained in:
commit
84b852933e
@ -630,7 +630,9 @@ abstract class PHP extends Engine
|
|||||||
$temp_value = [$quotient_value[$q_index]];
|
$temp_value = [$quotient_value[$q_index]];
|
||||||
$temp = $temp->multiply($y);
|
$temp = $temp->multiply($y);
|
||||||
$temp_value = &$temp->value;
|
$temp_value = &$temp->value;
|
||||||
|
if ($temp_value !== []) {
|
||||||
$temp_value = array_merge($adjust, $temp_value);
|
$temp_value = array_merge($adjust, $temp_value);
|
||||||
|
}
|
||||||
|
|
||||||
$x = $x->subtract($temp);
|
$x = $x->subtract($temp);
|
||||||
|
|
||||||
@ -736,6 +738,7 @@ abstract class PHP extends Engine
|
|||||||
$value = &$result->value;
|
$value = &$result->value;
|
||||||
|
|
||||||
if (!count($value)) {
|
if (!count($value)) {
|
||||||
|
$result->is_negative = false;
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -99,6 +99,22 @@ abstract class Unit_Math_BigInteger_TestCase extends PhpseclibTestCase
|
|||||||
|
|
||||||
$this->assertSame('95627922070', (string) $q);
|
$this->assertSame('95627922070', (string) $q);
|
||||||
$this->assertSame('10688759725', (string) $r);
|
$this->assertSame('10688759725', (string) $r);
|
||||||
|
|
||||||
|
$x = $this->getInstance('3369993333393829974333376885877453834204643052817571560137951281152');
|
||||||
|
$y = $this->getInstance('4294967296');
|
||||||
|
|
||||||
|
list($q, $r) = $x->divide($y);
|
||||||
|
|
||||||
|
$this->assertSame('784637716923335095479473677900958302012794430558004314112', (string) $q);
|
||||||
|
$this->assertSame('0', (string) $r);
|
||||||
|
|
||||||
|
$x = $this->getInstance('3369993333393829974333376885877453834204643052817571560137951281153');
|
||||||
|
$y = $this->getInstance('4294967296');
|
||||||
|
|
||||||
|
list($q, $r) = $x->divide($y);
|
||||||
|
|
||||||
|
$this->assertSame('784637716923335095479473677900958302012794430558004314112', (string) $q);
|
||||||
|
$this->assertSame('1', (string) $r);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testModPow()
|
public function testModPow()
|
||||||
|
Loading…
Reference in New Issue
Block a user