[swfinterp] Implement equals opcode
authorPhilipp Hagemeister <phihag@phihag.de>
Mon, 17 Nov 2014 03:27:51 +0000 (04:27 +0100)
committerPhilipp Hagemeister <phihag@phihag.de>
Mon, 17 Nov 2014 03:27:51 +0000 (04:27 +0100)
test/swftests/EqualsOperator.as [new file with mode: 0644]
youtube_dl/swfinterp.py

diff --git a/test/swftests/EqualsOperator.as b/test/swftests/EqualsOperator.as
new file mode 100644 (file)
index 0000000..837a69a
--- /dev/null
@@ -0,0 +1,10 @@
+// input: []
+// output: false
+
+package {
+public class EqualsOperator {
+    public static function main():Boolean{
+        return 1 == 2;
+    }
+}
+}
index 0ce8474ca7ce96d77d05b9c9c5243a6632b69591..1e8b26ecc4329282efbd85050f84007ab43ea1e1 100644 (file)
@@ -629,6 +629,11 @@ class SWFInterpreter(object):
                     value1 = stack.pop()
                     res = value1 % value2
                     stack.append(res)
+                elif opcode == 171:  # equals
+                    value2 = stack.pop()
+                    value1 = stack.pop()
+                    result = value1 == value2
+                    stack.append(result)
                 elif opcode == 175:  # greaterequals
                     value2 = stack.pop()
                     value1 = stack.pop()