From: Nicholas Clark Date: Sat, 9 Jul 2005 15:44:17 +0000 (+0000) Subject: sv_dec is supposed to go *down*, m'kay. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=f4eee32fe43c252f7ee773e7ba8b0e6d1793cdce;p=p5sagit%2Fp5-mst-13.2.git sv_dec is supposed to go *down*, m'kay. p4raw-id: //depot/perl@25102 --- diff --git a/sv.c b/sv.c index 268cb3a..99e456e 100644 --- a/sv.c +++ b/sv.c @@ -7067,7 +7067,7 @@ Perl_sv_dec(pTHX_ register SV *sv) } else { (void)SvIOK_only_UV(sv); - SvUV_set(sv, SvUVX(sv) + 1); + SvUV_set(sv, SvUVX(sv) - 1); } } else { if (SvIVX(sv) == IV_MIN) diff --git a/t/op/inc.t b/t/op/inc.t index 156ca92..5f05642 100755 --- a/t/op/inc.t +++ b/t/op/inc.t @@ -2,7 +2,7 @@ # use strict; -print "1..30\n"; +print "1..32\n"; my $test = 1; @@ -176,3 +176,12 @@ check_same (\%orig, \%postdec); ok($p == -1, $p); ok($@ eq '', $@); } + +$a = 2147483648; +$c=--$a; +ok ($a == 2147483647, $a); + + +$a = 2147483648; +$c=$a--; +ok ($a == 2147483647, $a);