Implement OP_MUL (no metamethod yet)

Sun, 21 Nov 2010 21:25:24 +0000

author
Matthew Wild <mwild1@gmail.com>
date
Sun, 21 Nov 2010 21:25:24 +0000
changeset 110
6a6e5ef39eaf
parent 109
db4b13efbd50
child 111
cb1ef8a51da4

Implement OP_MUL (no metamethod yet)

lvm.js file | annotate | diff | comparison | revisions
--- a/lvm.js	Sun Nov 21 21:17:59 2010 +0000
+++ b/lvm.js	Sun Nov 21 21:25:24 2010 +0000
@@ -13,7 +13,7 @@
 var OP_SELF = 11;
 var OP_ADD = 12;
 var OP_SUB = 13;
-//var OP_MUL = 14;
+var OP_MUL = 14;
 var OP_DIV = 15;
 //var OP_MOD = 16;
 //var OP_POW = 17;
@@ -620,6 +620,11 @@
 				var RC = RK(frame, INS_C(instruction));
 				frame.reg[INS_A(instruction)] = new LValue(this, "number", RB.value - RC.value);
 				break;
+			case OP_MUL:
+				var RB = RK(frame, INS_B(instruction));
+				var RC = RK(frame, INS_C(instruction));
+				frame.reg[INS_A(instruction)] = new LValue(this, "number", RB.value * RC.value);
+				break;
 			case OP_DIV:
 				var RB = RK(frame, INS_B(instruction));
 				var RC = RK(frame, INS_C(instruction));

mercurial