mirror of
https://github.com/danog/phpseclib.git
synced 2024-11-27 12:55:58 +01:00
Merge branch 'master' into biginteger-revamp
This commit is contained in:
commit
f8dc527af5
@ -2875,6 +2875,9 @@ class BigInteger
|
|||||||
// calculuate "not" without regard to $this->precision
|
// calculuate "not" without regard to $this->precision
|
||||||
// (will always result in a smaller number. ie. ~1 isn't 1111 1110 - it's 0)
|
// (will always result in a smaller number. ie. ~1 isn't 1111 1110 - it's 0)
|
||||||
$temp = $this->toBytes();
|
$temp = $this->toBytes();
|
||||||
|
if ($temp == '') {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
$pre_msb = decbin(ord($temp[0]));
|
$pre_msb = decbin(ord($temp[0]));
|
||||||
$temp = ~$temp;
|
$temp = ~$temp;
|
||||||
$msb = decbin(ord($temp[0]));
|
$msb = decbin(ord($temp[0]));
|
||||||
|
@ -217,6 +217,11 @@ abstract class Unit_Math_BigInteger_TestCase extends PhpseclibTestCase
|
|||||||
$z = $this->getInstance('11111111111111111111111', 16);
|
$z = $this->getInstance('11111111111111111111111', 16);
|
||||||
|
|
||||||
$this->assertSame($z->toHex(), $x->bitwise_NOT()->toHex());
|
$this->assertSame($z->toHex(), $x->bitwise_NOT()->toHex());
|
||||||
|
|
||||||
|
$a = $this->getInstance(0);
|
||||||
|
$a->bitwise_not();
|
||||||
|
|
||||||
|
$this->assertSame($a->toString(), '0');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testBitwiseLeftShift()
|
public function testBitwiseLeftShift()
|
||||||
|
Loading…
Reference in New Issue
Block a user