Attached patch gives i_postinc/i_postdec the same treatment as postinc/dec
in void context. Passes tests old and new.
We don't have many -Minteger tests, we could do with some more.
Hugo
--- op.c.old Fri Oct 14 00:31:31 2005
+++ op.c Fri Oct 14 18:01:42 2005
@@ -804,6 +804,16 @@
o->op_ppaddr = PL_ppaddr[OP_PREDEC];
break;
+ case OP_I_POSTINC:
+ o->op_type = OP_I_PREINC; /* pre-increment is faster */
+ o->op_ppaddr = PL_ppaddr[OP_I_PREINC];
+ break;
+
+ case OP_I_POSTDEC:
+ o->op_type = OP_I_PREDEC; /* pre-decrement is faster */
+ o->op_ppaddr = PL_ppaddr[OP_I_PREDEC];
+ break;
+
case OP_OR:
case OP_AND:
case OP_DOR:
--- t/op/inc.t.old Fri Jul 15 17:04:15 2005
+++ t/op/inc.t Fri Oct 14 18:21:08 2005
@@ -2,7 +2,7 @@
# use strict;
-print "1..32\n";
+print "1..34\n";
my $test = 1;
@@ -185,3 +185,12 @@
$a = 2147483648;
$c=$a--;
ok ($a == 2147483647, $a);
+
+{
+ use integer;
+ my $x = 0;
+ $x++;
+ ok ($x == 1, "(void) i_postinc");
+ $x--;
+ ok ($x == 0, "(void) i_postdec");
+}
Thread Next