File tree Expand file tree Collapse file tree 1 file changed +22
-1
lines changed Expand file tree Collapse file tree 1 file changed +22
-1
lines changed Original file line number Diff line number Diff line change @@ -9394,8 +9394,29 @@ Perl_newSVuv(pTHX_ const UV u)
9394
9394
{
9395
9395
SV * sv ;
9396
9396
9397
+ /* Inlining ONLY the small relevant subset of sv_setuv here
9398
+ * for performance. Makes a significant difference. */
9399
+
9400
+ /* Using ivs is more efficient than using uvs - see sv_setuv */
9401
+ if (u <= (UV )IV_MAX ) {
9402
+ return newSViv ((IV )u );
9403
+ }
9404
+
9397
9405
new_SV (sv );
9398
- sv_setuv (sv ,u );
9406
+
9407
+ /* We're starting from SVt_FIRST, so provided that's
9408
+ * actual 0, we don't have to unset any SV type flags
9409
+ * to promote to SVt_IV. */
9410
+ assert (SVt_FIRST == 0 );
9411
+
9412
+ SET_SVANY_FOR_BODYLESS_IV (sv );
9413
+ SvFLAGS (sv ) |= SVt_IV ;
9414
+ (void )SvIOK_on (sv );
9415
+ (void )SvIsUV_on (sv );
9416
+
9417
+ SvUV_set (sv , u );
9418
+ SvTAINT (sv );
9419
+
9399
9420
return sv ;
9400
9421
}
9401
9422
You can’t perform that action at this time.
0 commit comments