summaryrefslogtreecommitdiff
path: root/op.c
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2000-12-15 15:11:05 +0000
committerJarkko Hietaniemi <jhi@iki.fi>2000-12-15 15:11:05 +0000
commit98a29390254d3cb423096b6282689bfe2a7e6a13 (patch)
tree7bef01eb07750fb8e9686429e95216a0ca3281c5 /op.c
parentf7bbb42a8a35cccf48af0f4db3b373ffcb7e1ac5 (diff)
downloadperl-98a29390254d3cb423096b6282689bfe2a7e6a13.tar.gz
This seems to be a stage sane and stable enough to checkin.
(it basically is 8102..8118+8122 but no 8120, 8121, 8123, 8124) p4raw-id: //depot/perl@8125
Diffstat (limited to 'op.c')
-rw-r--r--op.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/op.c b/op.c
index e6f7804e9d..b6a9c7c04f 100644
--- a/op.c
+++ b/op.c
@@ -2249,11 +2249,13 @@ Perl_fold_constants(pTHX_ register OP *o)
if ((SvFLAGS(sv) & (SVf_IOK|SVf_NOK|SVf_POK)) == SVf_NOK &&
type != OP_NEGATE)
{
-#ifdef PERL_PRESERVE_IVUV
- /* Only bother to attempt to fold to IV if
- most operators will benefit */
- SvIV_please(sv);
-#endif
+ IV iv = SvIV(sv);
+ if ((NV)iv == SvNV(sv)) {
+ SvREFCNT_dec(sv);
+ sv = newSViv(iv);
+ }
+ else
+ SvIOK_off(sv); /* undo SvIV() damage */
}
return newSVOP(OP_CONST, 0, sv);
}