Skip to content

Commit 31e370b

Browse files
committed
Add mnemonics that are csts from float types
1 parent 9c0d917 commit 31e370b

3 files changed

Lines changed: 21 additions & 3 deletions

File tree

src/Kernel/Mnemonics/_f2d.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22
namespace PHPJava\Kernel\Mnemonics;
33

44
use PHPJava\Exceptions\NotImplementedException;
5+
use PHPJava\Kernel\Types\_Double;
56
use PHPJava\Utilities\BinaryTool;
7+
use PHPJava\Utilities\Extractor;
68

79
final class _f2d implements OperationInterface
810
{
@@ -11,6 +13,10 @@ final class _f2d implements OperationInterface
1113

1214
public function execute(): void
1315
{
14-
throw new NotImplementedException(__CLASS__);
16+
$value = Extractor::realValue(
17+
$this->popFromOperandStack()
18+
);
19+
20+
$this->pushToOperandStack(new _Double($value));
1521
}
1622
}

src/Kernel/Mnemonics/_f2i.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22
namespace PHPJava\Kernel\Mnemonics;
33

44
use PHPJava\Exceptions\NotImplementedException;
5+
use PHPJava\Kernel\Types\_Int;
56
use PHPJava\Utilities\BinaryTool;
7+
use PHPJava\Utilities\Extractor;
68

79
final class _f2i implements OperationInterface
810
{
@@ -11,6 +13,10 @@ final class _f2i implements OperationInterface
1113

1214
public function execute(): void
1315
{
14-
throw new NotImplementedException(__CLASS__);
16+
$value = Extractor::realValue(
17+
$this->popFromOperandStack()
18+
);
19+
20+
$this->pushToOperandStack(new _Int($value));
1521
}
1622
}

src/Kernel/Mnemonics/_f2l.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22
namespace PHPJava\Kernel\Mnemonics;
33

44
use PHPJava\Exceptions\NotImplementedException;
5+
use PHPJava\Kernel\Types\_Long;
56
use PHPJava\Utilities\BinaryTool;
7+
use PHPJava\Utilities\Extractor;
68

79
final class _f2l implements OperationInterface
810
{
@@ -11,6 +13,10 @@ final class _f2l implements OperationInterface
1113

1214
public function execute(): void
1315
{
14-
throw new NotImplementedException(__CLASS__);
16+
$value = Extractor::realValue(
17+
$this->popFromOperandStack()
18+
);
19+
20+
$this->pushToOperandStack(new _Long($value));
1521
}
1622
}

0 commit comments

Comments
 (0)