-
Notifications
You must be signed in to change notification settings - Fork 36
Expand file tree
/
Copy path_dcmpl.php
More file actions
45 lines (38 loc) · 1.1 KB
/
_dcmpl.php
File metadata and controls
45 lines (38 loc) · 1.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<?php
declare(strict_types=1);
namespace PHPJava\Kernel\Mnemonics;
use PHPJava\Kernel\Filters\Normalizer;
use PHPJava\Kernel\Types\Int_;
final class _dcmpl extends AbstractOperationCode implements OperationCodeInterface
{
protected $isStackingOperation = true;
public function getOperands(): ?Operands
{
parent::getOperands();
if ($this->operands !== null) {
return $this->operands;
}
return $this->operands = new Operands();
}
public function execute(): void
{
parent::execute();
$rightOperand = Normalizer::getPrimitiveValue($this->popFromOperandStack());
$leftOperand = Normalizer::getPrimitiveValue($this->popFromOperandStack());
if ($leftOperand > $rightOperand) {
$this->pushToOperandStack(
Int_::get(1)
);
return;
}
if ($leftOperand < $rightOperand) {
$this->pushToOperandStack(
Int_::get(-1)
);
return;
}
$this->pushToOperandStack(
Int_::get(0)
);
}
}