◐ Shell
reader mode source ↗
Skip to content

Commit cb95f98

Browse files
authored
Merge pull request #34 from y-uti/fix-operand-order
Fix order of values popped from the operand stack
2 parents 28e1079 + 68335b3 commit cb95f98

31 files changed

Lines changed: 275 additions & 31 deletions
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ final class _dadd implements OperationInterface
1111

1212
public function execute(): void
1313
{
14-
$value1 = $this->getStack();
1514
$value2 = $this->getStack();
15+
$value1 = $this->getStack();
1616

1717
$this->pushStack(BinaryTool::add($value1, $value2));
1818
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ final class _dmul implements OperationInterface
1111

1212
public function execute(): void
1313
{
14-
$value1 = $this->getStack();
1514
$value2 = $this->getStack();
15+
$value1 = $this->getStack();
1616

1717
$this->pushStack(BinaryTool::multiply($value1, $value2, 8));
1818
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ final class _dsub implements OperationInterface
1111

1212
public function execute(): void
1313
{
14-
$leftValue = $this->getStack();
1514
$rightValue = $this->getStack();
15+
$leftValue = $this->getStack();
1616

1717
$this->pushStack(BinaryTool::sub($leftValue, $rightValue, 8));
1818
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ final class _iadd implements OperationInterface
1111

1212
public function execute(): void
1313
{
14-
$leftValue = $this->getStack();
1514
$rightValue = $this->getStack();
15+
$leftValue = $this->getStack();
1616

1717
$this->pushStack(BinaryTool::add($leftValue, $rightValue));
1818
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ final class _iand implements OperationInterface
1111

1212
public function execute(): void
1313
{
14-
$value1 = $this->getStack();
1514
$value2 = $this->getStack();
15+
$value1 = $this->getStack();
1616

1717
$this->pushStack(BinaryTool::andBits($value1, $value2, 4));
1818
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ public function execute(): void
1313
{
1414
$offset = $this->readShort();
1515

16-
$leftOperand = $this->getStack();
1716
$rightOperand = $this->getStack();
17+
$leftOperand = $this->getStack();
1818

1919
if ($leftOperand === $rightOperand) {
2020
$this->setOffset($this->getProgramCounter() + $offset);
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ public function execute(): void
1313
{
1414
$offset = $this->readShort();
1515

16-
$leftOperand = $this->getStack();
1716
$rightOperand = $this->getStack();
17+
$leftOperand = $this->getStack();
1818

1919
if ($leftOperand !== $rightOperand) {
2020
$this->setOffset($this->getProgramCounter() + $offset);
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ public function execute(): void
1313
{
1414
$offset = $this->readShort();
1515

16-
$leftOperand = $this->getStack();
1716
$rightOperand = $this->getStack();
17+
$leftOperand = $this->getStack();
1818

19-
if ($leftOperand <= $rightOperand) {
19+
if ($leftOperand >= $rightOperand) {
2020
$this->setOffset($this->getProgramCounter() + $offset);
2121
}
2222
}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ public function execute(): void
1313
{
1414
$offset = $this->readShort();
1515

16-
$leftOperand = $this->getStack();
1716
$rightOperand = $this->getStack();
17+
$leftOperand = $this->getStack();
1818

19-
if ($leftOperand < $rightOperand) {
19+
if ($leftOperand > $rightOperand) {
2020
$this->setOffset($this->getProgramCounter() + $offset);
2121
}
2222
}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ public function execute(): void
1313
{
1414
$offset = $this->readShort();
1515

16-
$leftOperand = $this->getStack();
1716
$rightOperand = $this->getStack();
17+
$leftOperand = $this->getStack();
1818

19-
if ($rightOperand < $leftOperand) {
19+
if ($leftOperand < $rightOperand) {
2020
$this->setOffset($this->getProgramCounter() + $offset);
2121
}
2222
}

0 commit comments

Comments
 (0)