From: Gurusamy Sarathy <gsar@cpan.org>
Date: Sun, 5 Mar 2000 04:50:26 +0000 (+0000)
Subject: optimize change#5533 to stick to IVs if constant is <= IV_MAX,
X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=5a89daa8ec9b19ce15af46edf1370e5e0067ec4e;p=p5sagit%2Fp5-mst-13.2.git

optimize change#5533 to stick to IVs if constant is <= IV_MAX,
since runtime is highly optimized for IVs rather than UVs

p4raw-link: @5533 on //depot/perl: 9b0e499bcdd1e62b4ead7739d3482d056b5ac3dc

p4raw-id: //depot/perl@5534
---

diff --git a/toke.c b/toke.c
index 8a21303..a7be0a4 100644
--- a/toke.c
+++ b/toke.c
@@ -6954,8 +6954,12 @@ Perl_scan_num(pTHX_ char *start)
 	   conversion at all.
 	*/
 	tryuv = U_V(value);
-	if (!floatit && (NV)tryuv == value)
-	    sv_setuv(sv, tryuv);
+	if (!floatit && (NV)tryuv == value) {
+	    if (tryuv <= IV_MAX)
+		sv_setiv(sv, (IV)tryuv);
+	    else
+		sv_setuv(sv, tryuv);
+	}
 	else
 	    sv_setnv(sv, value);
 	if ( floatit ? (PL_hints & HINT_NEW_FLOAT) :