summaryrefslogtreecommitdiff
path: root/pp_hot.c
diff options
context:
space:
mode:
authorJerry D. Hedden <jdhedden@cpan.org>2007-10-18 10:49:40 -0400
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>2007-10-19 07:47:45 +0000
commit800401ee2a8a5a67ef478227b68426cf701d0116 (patch)
tree25f017405848df7adfd1d53360318ef4466dc76a /pp_hot.c
parentc62eb2047c09034e319c2e6d5aaba369cad92b76 (diff)
downloadperl-800401ee2a8a5a67ef478227b68426cf701d0116.tar.gz
Fix overloading for 64-bit ints (revised)
From: "Jerry D. Hedden" <jdhedden@cpan.org> Message-ID: <1ff86f510710181149s1c096dd9qffa8fe42046e675b@mail.gmail.com> p4raw-id: //depot/perl@32141
Diffstat (limited to 'pp_hot.c')
-rw-r--r--pp_hot.c27
1 files changed, 15 insertions, 12 deletions
diff --git a/pp_hot.c b/pp_hot.c
index 423c4c8e76..17eb6f2917 100644
--- a/pp_hot.c
+++ b/pp_hot.c
@@ -496,8 +496,11 @@ PP(pp_defined)
PP(pp_add)
{
- dVAR; dSP; dATARGET; bool useleft; tryAMAGICbin(add,opASSIGN);
- useleft = USE_LEFT(TOPm1s);
+ dVAR; dSP; dATARGET; bool useleft; SV *svl, *svr;
+ tryAMAGICbin(add,opASSIGN);
+ svl = sv_2num(TOPm1s);
+ svr = sv_2num(TOPs);
+ useleft = USE_LEFT(svl);
#ifdef PERL_PRESERVE_IVUV
/* We must see if we can perform the addition with integers if possible,
as the integer code detects overflow while the NV code doesn't.
@@ -545,8 +548,8 @@ PP(pp_add)
unsigned code below is actually shorter than the old code. :-)
*/
- SvIV_please(TOPs);
- if (SvIOK(TOPs)) {
+ SvIV_please(svr);
+ if (SvIOK(svr)) {
/* Unless the left argument is integer in range we are going to have to
use NV maths. Hence only attempt to coerce the right argument if
we know the left is integer. */
@@ -562,12 +565,12 @@ PP(pp_add)
lots of code to speed up what is probably a rarish case. */
} else {
/* Left operand is defined, so is it IV? */
- SvIV_please(TOPm1s);
- if (SvIOK(TOPm1s)) {
- if ((auvok = SvUOK(TOPm1s)))
- auv = SvUVX(TOPm1s);
+ SvIV_please(svl);
+ if (SvIOK(svl)) {
+ if ((auvok = SvUOK(svl)))
+ auv = SvUVX(svl);
else {
- register const IV aiv = SvIVX(TOPm1s);
+ register const IV aiv = SvIVX(svl);
if (aiv >= 0) {
auv = aiv;
auvok = 1; /* Now acting as a sign flag. */
@@ -582,12 +585,12 @@ PP(pp_add)
bool result_good = 0;
UV result;
register UV buv;
- bool buvok = SvUOK(TOPs);
+ bool buvok = SvUOK(svr);
if (buvok)
- buv = SvUVX(TOPs);
+ buv = SvUVX(svr);
else {
- register const IV biv = SvIVX(TOPs);
+ register const IV biv = SvIVX(svr);
if (biv >= 0) {
buv = biv;
buvok = 1;