cvsuser 04/10/05 09:22:39
Modified: imcc imcc.y
ops math.ops
Log:
ops for 31848
Courtesy of Chromatic <[EMAIL PROTECTED]>
Revision Changes Path
1.146 +2 -2 parrot/imcc/imcc.y
Index: imcc.y
===================================================================
RCS file: /cvs/public/parrot/imcc/imcc.y,v
retrieving revision 1.145
retrieving revision 1.146
diff -u -w -r1.145 -r1.146
--- imcc.y 5 Oct 2004 15:23:52 -0000 1.145
+++ imcc.y 5 Oct 2004 16:22:38 -0000 1.146
@@ -896,8 +896,8 @@
{ $$ = MK_I(interp, cur_unit, "mul", 2, $1, $3); }
| target DIV_ASSIGN var
{ $$ = MK_I(interp, cur_unit, "div", 2, $1, $3); }
- | target MOD_ASSIGN var /* TODO 2 args opcodes */
- { $$ = MK_I(interp, cur_unit, "mod", 3, $1, $1, $3); }
+ | target MOD_ASSIGN var
+ { $$ = MK_I(interp, cur_unit, "mod", 2, $1, $3); }
| target FDIV_ASSIGN var
{ $$ = MK_I(interp, cur_unit, "fdiv", 2, $1, $3); }
| target CONCAT_ASSIGN var
1.27 +20 -2 parrot/ops/math.ops
Index: math.ops
===================================================================
RCS file: /cvs/public/parrot/ops/math.ops,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -w -r1.26 -r1.27
--- math.ops 25 Aug 2004 08:03:19 -0000 1.26
+++ math.ops 5 Oct 2004 16:22:39 -0000 1.27
@@ -636,6 +636,11 @@
=cut
+op mod(inout INT, in INT) :base_core {
+ $1 = intval_mod($1, $2);
+ goto NEXT();
+}
+
op mod(out INT, in INT, in INT) :base_core {
$1 = intval_mod($2, $3);
goto NEXT();
@@ -646,8 +651,8 @@
goto NEXT();
}
-inline op mod (in PMC, in INT ) :base_core {
- mmd_dispatch_v_pip(interpreter, $1, $2, $1, MMD_MOD_INT);
+inline op mod (in PMC, in PMC) :base_core {
+ mmd_dispatch_v_ppp(interpreter, $1, $2, $1, MMD_MOD);
goto NEXT();
}
@@ -656,11 +661,20 @@
goto NEXT();
}
+inline op mod(in PMC, in INT) :base_core {
+ mmd_dispatch_v_pip(interpreter, $1, $2, $1, MMD_MOD_INT);
+ goto NEXT();
+}
+
inline op mod(in PMC, in PMC, in NUM) :base_core {
mmd_dispatch_v_pnp(interpreter, $2, $3, $1, MMD_MOD_FLOAT);
goto NEXT();
}
+inline op mod(in PMC, in NUM) :base_core {
+ mmd_dispatch_v_pnp(interpreter, $1, $2, $1, MMD_MOD_FLOAT);
+ goto NEXT();
+}
########################################
@@ -685,6 +699,10 @@
goto NEXT();
}
+op mod(inout NUM, in NUM) :base_core {
+ $1 = floatval_mod($1, $2);
+ goto NEXT();
+}
########################################