File tree Expand file tree Collapse file tree 9 files changed +77
-10
lines changed
Expand file tree Collapse file tree 9 files changed +77
-10
lines changed Original file line number Diff line number Diff line change 11<?php
22namespace PHPJava \Imitation \java \lang ;
33
4+ use PHPJava \Utilities \Extractor ;
5+
46class 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}
Original file line number Diff line number Diff line change 22namespace PHPJava \Kernel \Mnemonics ;
33
44use PHPJava \Exceptions \NotImplementedException ;
5+ use PHPJava \Kernel \Types \_Int ;
56use PHPJava \Utilities \BinaryTool ;
7+ use PHPJava \Utilities \Extractor ;
68
79final 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}
Original file line number Diff line number Diff line change 22namespace PHPJava \Kernel \Mnemonics ;
33
44use PHPJava \Exceptions \NotImplementedException ;
5+ use PHPJava \Kernel \Types \_Int ;
56use PHPJava \Utilities \BinaryTool ;
7+ use PHPJava \Utilities \Extractor ;
68
79final 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}
Original file line number Diff line number Diff line change 22namespace PHPJava \Kernel \Mnemonics ;
33
44use PHPJava \Exceptions \NotImplementedException ;
5+ use PHPJava \Kernel \Types \_Int ;
56use PHPJava \Utilities \BinaryTool ;
7+ use PHPJava \Utilities \Extractor ;
68
79final 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}
Original file line number Diff line number Diff line change 22namespace PHPJava \Kernel \Mnemonics ;
33
44use PHPJava \Exceptions \NotImplementedException ;
5+ use PHPJava \Kernel \Types \_Int ;
56use PHPJava \Utilities \BinaryTool ;
7+ use PHPJava \Utilities \Extractor ;
68
79final 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}
Original file line number Diff line number Diff line change 22namespace PHPJava \Kernel \Mnemonics ;
33
44use PHPJava \Exceptions \NotImplementedException ;
5+ use PHPJava \Kernel \Types \_Int ;
56use PHPJava \Utilities \BinaryTool ;
7+ use PHPJava \Utilities \Extractor ;
68
79final 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}
Original file line number Diff line number Diff line change 22namespace PHPJava \Kernel \Mnemonics ;
33
44use PHPJava \Exceptions \NotImplementedException ;
5+ use PHPJava \Kernel \Types \_Int ;
56use PHPJava \Utilities \BinaryTool ;
7+ use PHPJava \Utilities \Extractor ;
68
79final 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}
Original file line number Diff line number Diff line change 33
44use PHPJava \Exceptions \NotImplementedException ;
55use PHPJava \Utilities \BinaryTool ;
6+ use PHPJava \Utilities \Extractor ;
67
78final 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 );
Original file line number Diff line number Diff line change 33
44use PHPJava \Exceptions \NotImplementedException ;
55use PHPJava \Utilities \BinaryTool ;
6+ use PHPJava \Utilities \Extractor ;
67
78final 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 );
You can’t perform that action at this time.
0 commit comments