◐ Shell
reader mode source ↗
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
File filter
Conversations
Jump to
Diff view
Apply and reload
Show whitespace
Diff view
Apply and reload
2 changes: 1 addition & 1 deletion src/Kernel/Mnemonics/_dadd.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ final class _dadd implements OperationInterface

public function execute(): void
{
$value1 = $this->getStack();
$value2 = $this->getStack();

$this->pushStack(BinaryTool::add($value1, $value2));
}
Expand Down
2 changes: 1 addition & 1 deletion src/Kernel/Mnemonics/_dmul.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ final class _dmul implements OperationInterface

public function execute(): void
{
$value1 = $this->getStack();
$value2 = $this->getStack();

$this->pushStack(BinaryTool::multiply($value1, $value2, 8));
}
Expand Down
2 changes: 1 addition & 1 deletion src/Kernel/Mnemonics/_dsub.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ final class _dsub implements OperationInterface

public function execute(): void
{
$leftValue = $this->getStack();
$rightValue = $this->getStack();

$this->pushStack(BinaryTool::sub($leftValue, $rightValue, 8));
}
Expand Down
2 changes: 1 addition & 1 deletion src/Kernel/Mnemonics/_iadd.php
Original file line number Diff line number Diff line change
@@ -11,8 +11,8 @@ final class _iadd implements OperationInterface

public function execute(): void
{
$leftValue = $this->getStack();
$rightValue = $this->getStack();

$this->pushStack(BinaryTool::add($leftValue, $rightValue));
}
2 changes: 1 addition & 1 deletion src/Kernel/Mnemonics/_if_acmpeq.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ public function execute(): void
{
$offset = $this->readShort();

$leftOperand = $this->getStack();
$rightOperand = $this->getStack();

if ($leftOperand === $rightOperand) {
$this->setOffset($this->getProgramCounter() + $offset);
Expand Down
2 changes: 1 addition & 1 deletion src/Kernel/Mnemonics/_if_acmpne.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ public function execute(): void
{
$offset = $this->readShort();

$leftOperand = $this->getStack();
$rightOperand = $this->getStack();

if ($leftOperand !== $rightOperand) {
$this->setOffset($this->getProgramCounter() + $offset);
Expand Down
4 changes: 2 additions & 2 deletions src/Kernel/Mnemonics/_if_icmpgt.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ public function execute(): void
{
$offset = $this->readShort();

$leftOperand = $this->getStack();
$rightOperand = $this->getStack();

if ($leftOperand < $rightOperand) {
$this->setOffset($this->getProgramCounter() + $offset);
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/Kernel/Mnemonics/_if_icmplt.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ public function execute(): void
{
$offset = $this->readShort();

$leftOperand = $this->getStack();
$rightOperand = $this->getStack();

if ($rightOperand < $leftOperand) {
$this->setOffset($this->getProgramCounter() + $offset);
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/Kernel/Mnemonics/_if_icmpne.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ public function execute(): void
{
$offset = $this->readShort();

$leftOperand = $this->getStack();
$rightOperand = $this->getStack();

if ($leftOperand != $rightOperand) {
$this->setOffset($this->getProgramCounter() + $offset);
2 changes: 1 addition & 1 deletion src/Kernel/Mnemonics/_imul.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ final class _imul implements OperationInterface

public function execute(): void
{
$value1 = $this->getStack();
$value2 = $this->getStack();

$this->pushStack(BinaryTool::multiply($value1, $value2, 4));
}
Expand Down
2 changes: 1 addition & 1 deletion src/Kernel/Mnemonics/_ior.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ final class _ior implements OperationInterface

public function execute(): void
{
$value1 = $this->getStack();
$value2 = $this->getStack();

$this->pushStack(BinaryTool::orBits($value1, $value2, 4));
}
Expand Down
2 changes: 1 addition & 1 deletion src/Kernel/Mnemonics/_ishl.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ final class _ishl implements OperationInterface

public function execute(): void
{
$value1 = $this->getStack();
$value2 = $this->getStack();

$this->pushStack(BinaryTool::shiftLeft($value1, $value2));
}
Expand Down
2 changes: 1 addition & 1 deletion src/Kernel/Mnemonics/_isub.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ final class _isub implements OperationInterface

public function execute(): void
{
$leftValue = $this->getStack();
$rightValue = $this->getStack();

$this->pushStack(BinaryTool::sub($leftValue, $rightValue, 4));
}
Expand Down
2 changes: 1 addition & 1 deletion src/Kernel/Mnemonics/_iushr.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ final class _iushr implements OperationInterface

public function execute(): void
{
$value1 = $this->getStack();
$value2 = $this->getStack();

$this->pushStack(BinaryTool::unsignedShiftRight($value1, $value2, 4));
}
2 changes: 1 addition & 1 deletion src/Kernel/Mnemonics/_ixor.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ final class _ixor implements OperationInterface

public function execute(): void
{
$value1 = $this->getStack();
$value2 = $this->getStack();

$this->pushStack(BinaryTool::xorBits($value1, $value2, 4));
}
Expand Down
2 changes: 1 addition & 1 deletion src/Kernel/Mnemonics/_land.php
Original file line number Diff line number Diff line change
@@ -11,8 +11,8 @@ final class _land implements OperationInterface

public function execute(): void
{
$value1 = $this->getStack();
$value2 = $this->getStack();

$this->pushStack(BinaryTool::andBits($value1, $value2, 8));
}
Expand Down
2 changes: 1 addition & 1 deletion src/Kernel/Mnemonics/_lmul.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ final class _lmul implements OperationInterface

public function execute(): void
{
$value1 = $this->getStack();
$value2 = $this->getStack();

$this->pushStack(BinaryTool::multiply($value1, $value2, 8));
}
Expand Down
2 changes: 1 addition & 1 deletion src/Kernel/Mnemonics/_lor.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ final class _lor implements OperationInterface

public function execute(): void
{
$value1 = $this->getStack();
$value2 = $this->getStack();

$this->pushStack(BinaryTool::orBits($value1, $value2, 8));
}
Expand Down
2 changes: 1 addition & 1 deletion src/Kernel/Mnemonics/_lshl.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ final class _lshl implements OperationInterface

public function execute(): void
{
$value1 = $this->getStack();
$value2 = $this->getStack();

$this->pushStack(BinaryTool::shiftLeft($value1, $value2));
}
Expand Down
2 changes: 1 addition & 1 deletion src/Kernel/Mnemonics/_lshr.php
Original file line number Diff line number Diff line change
@@ -11,8 +11,8 @@ final class _lshr implements OperationInterface

public function execute(): void
{
$value1 = $this->getStack();
$value2 = $this->getStack();

$this->pushStack(BinaryTool::shiftRight($value1, $value2, 8));
}
Expand Down
2 changes: 1 addition & 1 deletion src/Kernel/Mnemonics/_lsub.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ final class _lsub implements OperationInterface

public function execute(): void
{
$value1 = $this->getStack();
$value2 = $this->getStack();

$this->pushStack(BinaryTool::sub($value1, $value2, 8));
}
Expand Down
2 changes: 1 addition & 1 deletion src/Kernel/Mnemonics/_lushr.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ final class _lushr implements OperationInterface

public function execute(): void
{
$value1 = $this->getStack();
$value2 = $this->getStack();

$this->pushStack(BinaryTool::unsignedShiftRight($value1, $value2, 8));
}
Expand Down
85 changes: 85 additions & 0 deletions tests/BinaryOperatorTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
Loading
Toggle all file notes Toggle all file annotations