BigInteger/PHP: make sure that zero is represented uniformly

This commit is contained in:
terrafrost 2018-04-03 20:23:47 -05:00
parent d4b0e00d14
commit 011f6ad200

View File

@ -108,6 +108,10 @@ abstract class PHP extends Engine
while (strlen($x)) {
$this->value[] = self::bytes2int(self::base256_rshift($x, static::BASE));
}
if ($this->value == [0]) {
$this->value = [];
}
break;
case 16:
$x = (strlen($this->value) & 1) ? '0' . $this->value : $this->value;