Changed: #2228 AS1/2/3 bitwise operations use hexadecimal operands

This commit is contained in:
Jindra Petřík
2024-08-01 22:24:01 +02:00
parent 5fb20268b2
commit 9683dc6a6f
23 changed files with 226 additions and 33 deletions

View File

@@ -2465,4 +2465,17 @@ public class ActionScript2Test extends ActionScript2TestBase {
+ "trace(\"functionPostIncrementTest\");\r\n"
);
}
@Test
public void frame90_bitwiseOperandsTest() {
compareSrc(90, "trace(\"bitwiseOperandsTest\");\r\n"
+ "var a = 100;\r\n"
+ "var b = a & 0x08FF;\r\n"
+ "var c = 0x08FF & a;\r\n"
+ "var d = a | 0x0480;\r\n"
+ "var e = 0x0480 | a;\r\n"
+ "var f = a ^ 0x0641;\r\n"
+ "var g = 0x0641 ^ a;\r\n"
);
}
}

View File

@@ -180,8 +180,8 @@ public class ActionScript3AssembledDecompileTest extends ActionScript3DecompileT
+ "§§push(50);\r\n"
+ "while(§§dup(§§pop()))\r\n"
+ "{\r\n"
+ "§§dup(§§pop())[§§dup(§§dup(§§pop())).length] = 41 ^ 111;\r\n"
+ "§§dup(§§pop())[§§dup(§§dup(§§pop())).length] = 9 ^ 84;\r\n"
+ "§§dup(§§pop())[§§dup(§§dup(§§pop())).length] = 0x29 ^ 0x6F;\r\n"
+ "§§dup(§§pop())[§§dup(§§dup(§§pop())).length] = 9 ^ 0x54;\r\n"
+ "§§push(§§pop() - 1);\r\n"
+ "}\r\n"
+ "§§pop();\r\n"

View File

@@ -51,6 +51,19 @@ public class ActionScript3ClassicAirDecompileTest extends ActionScript3Decompile
false);
}
@Test
public void testBitwiseOperands() {
decompileMethod("classic_air", "testBitwiseOperands", "var a:int = 100;\r\n"
+ "var b:* = a & 0x08FF;\r\n"
+ "var c:* = 0x08FF & a;\r\n"
+ "var d:* = a | 0x0480;\r\n"
+ "var e:* = 0x0480 | a;\r\n"
+ "var f:* = a ^ 0x0641;\r\n"
+ "var g:* = 0x0641 ^ a;\r\n"
+ "var h:int = -385;\r\n",
false);
}
@Test
public void testCallCall() {
decompileMethod("classic_air", "testCallCall", "var o:* = new getDefinitionByName(\"Object\");\r\n"

View File

@@ -51,6 +51,19 @@ public class ActionScript3ClassicDecompileTest extends ActionScript3DecompileTes
false);
}
@Test
public void testBitwiseOperands() {
decompileMethod("classic", "testBitwiseOperands", "var a:int = 100;\r\n"
+ "var b:int = a & 0x08FF;\r\n"
+ "var c:int = 0x08FF & a;\r\n"
+ "var d:int = a | 0x0480;\r\n"
+ "var e:int = 0x0480 | a;\r\n"
+ "var f:int = a ^ 0x0641;\r\n"
+ "var g:int = 0x0641 ^ a;\r\n"
+ "var h:int = ~0x0180;\r\n",
false);
}
@Test
public void testCallCall() {
decompileMethod("classic", "testCallCall", "var o:* = new getDefinitionByName(\"Object\")();\r\n"
@@ -182,7 +195,7 @@ public class ActionScript3ClassicDecompileTest extends ActionScript3DecompileTes
+ "trace(\"arr[call()] /= 5\");\r\n"
+ "b[this.calc()] = b[this.calc()] / 5;\r\n"
+ "trace(\"arr[call()][call()] &= 10;\");\r\n"
+ "b[this.calc()][this.calc()] = b[this.calc()][this.calc()] & 10;\r\n"
+ "b[this.calc()][this.calc()] = b[this.calc()][this.calc()] & 0x0A;\r\n"
+ "try\r\n"
+ "{\r\n"
+ "trace(\"in try\");\r\n"