Skip to content

Commit bb06bdf

Browse files
committed
Ignore ambiguous
1 parent 5a5500a commit bb06bdf

File tree

9 files changed

+77
-10
lines changed

9 files changed

+77
-10
lines changed

src/Imitation/java/lang/Math.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
<?php
22
namespace PHPJava\Imitation\java\lang;
33

4+
use PHPJava\Utilities\Extractor;
5+
46
class Math extends _Object
57
{
68
public static $E = M_E;
@@ -14,7 +16,7 @@ class Math extends _Object
1416
*/
1517
public static function abs($number)
1618
{
17-
return abs($number);
19+
return abs(Extractor::realValue($number));
1820
}
1921

2022
/**
@@ -26,6 +28,6 @@ public static function abs($number)
2628
*/
2729
public static function decrementExact($a)
2830
{
29-
return $a - 1;
31+
return Extractor::realValue($a) - 1;
3032
}
3133
}

src/Kernel/Mnemonics/_iand.php

Lines changed: 11 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 _iand implements OperationInterface
810
{
@@ -14,6 +16,14 @@ public function execute(): void
1416
$value2 = $this->getStack();
1517
$value1 = $this->getStack();
1618

17-
$this->pushStack(BinaryTool::andBits($value1, $value2, 4));
19+
$this->pushStack(
20+
new _Int(
21+
BinaryTool::andBits(
22+
Extractor::realValue($value1),
23+
Extractor::realValue($value2),
24+
4
25+
)
26+
)
27+
);
1828
}
1929
}

src/Kernel/Mnemonics/_ior.php

Lines changed: 11 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 _ior implements OperationInterface
810
{
@@ -14,6 +16,14 @@ public function execute(): void
1416
$value2 = $this->getStack();
1517
$value1 = $this->getStack();
1618

17-
$this->pushStack(BinaryTool::orBits($value1, $value2, 4));
19+
$this->pushStack(
20+
new _Int(
21+
BinaryTool::orBits(
22+
Extractor::realValue($value1),
23+
Extractor::realValue($value2),
24+
4
25+
)
26+
)
27+
);
1828
}
1929
}

src/Kernel/Mnemonics/_ishl.php

Lines changed: 10 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 _ishl implements OperationInterface
810
{
@@ -14,6 +16,13 @@ public function execute(): void
1416
$value2 = $this->getStack();
1517
$value1 = $this->getStack();
1618

17-
$this->pushStack(BinaryTool::shiftLeft($value1, $value2));
19+
$this->pushStack(
20+
new _Int(
21+
BinaryTool::shiftLeft(
22+
Extractor::realValue($value1),
23+
Extractor::realValue($value2)
24+
)
25+
)
26+
);
1827
}
1928
}

src/Kernel/Mnemonics/_ishr.php

Lines changed: 11 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 _ishr implements OperationInterface
810
{
@@ -14,6 +16,14 @@ public function execute(): void
1416
$value2 = $this->getStack();
1517
$value1 = $this->getStack();
1618

17-
$this->pushStack(BinaryTool::shiftRight($value1, $value2, 4));
19+
$this->pushStack(
20+
new _Int(
21+
BinaryTool::shiftRight(
22+
Extractor::realValue($value1),
23+
Extractor::realValue($value2),
24+
4
25+
)
26+
)
27+
);
1828
}
1929
}

src/Kernel/Mnemonics/_iushr.php

Lines changed: 11 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 _iushr implements OperationInterface
810
{
@@ -14,6 +16,14 @@ public function execute(): void
1416
$value2 = $this->getStack();
1517
$value1 = $this->getStack();
1618

17-
$this->pushStack(BinaryTool::unsignedShiftRight($value1, $value2, 4));
19+
$this->pushStack(
20+
new _Int(
21+
BinaryTool::unsignedShiftRight(
22+
Extractor::realValue($value1),
23+
Extractor::realValue($value2),
24+
4
25+
)
26+
)
27+
);
1828
}
1929
}

src/Kernel/Mnemonics/_ixor.php

Lines changed: 11 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 _ixor implements OperationInterface
810
{
@@ -14,6 +16,14 @@ public function execute(): void
1416
$value2 = $this->getStack();
1517
$value1 = $this->getStack();
1618

17-
$this->pushStack(BinaryTool::xorBits($value1, $value2, 4));
19+
$this->pushStack(
20+
new _Int(
21+
BinaryTool::xorBits(
22+
Extractor::realValue($value1),
23+
Extractor::realValue($value2),
24+
4
25+
)
26+
)
27+
);
1828
}
1929
}

src/Kernel/Mnemonics/_lookupswitch.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
use PHPJava\Exceptions\NotImplementedException;
55
use PHPJava\Utilities\BinaryTool;
6+
use PHPJava\Utilities\Extractor;
67

78
final class _lookupswitch implements OperationInterface
89
{
@@ -11,7 +12,9 @@ final class _lookupswitch implements OperationInterface
1112

1213
public function execute(): void
1314
{
14-
$key = $this->getStack();
15+
$key = Extractor::realValue(
16+
$this->getStack()
17+
);
1518

1619
// padding data
1720
$paddingData = 4 - (($this->getOffset()) % 4);

src/Kernel/Mnemonics/_tableswitch.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
use PHPJava\Exceptions\NotImplementedException;
55
use PHPJava\Utilities\BinaryTool;
6+
use PHPJava\Utilities\Extractor;
67

78
final class _tableswitch implements OperationInterface
89
{
@@ -11,7 +12,9 @@ final class _tableswitch implements OperationInterface
1112

1213
public function execute(): void
1314
{
14-
$key = $this->getStack();
15+
$key = Extractor::realValue(
16+
$this->getStack()
17+
);
1518

1619
// padding data
1720
$paddingData = 4 - (($this->getOffset()) % 4);

0 commit comments

Comments
 (0)