optimize change#5533 to stick to IVs if constant is <= IV_MAX,
Gurusamy Sarathy [Sun, 5 Mar 2000 04:50:26 +0000 (04:50 +0000)]
since runtime is highly optimized for IVs rather than UVs

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

p4raw-id: //depot/perl@5534

toke.c

diff --git a/toke.c b/toke.c
index 8a21303..a7be0a4 100644 (file)
--- 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) :