Skip to content

Commit fbebf96

Browse files
committed
Perl_sv_setsv_flags: handle mixed IV and NV fast case
When the fast code at the start of Perl_sv_setsv_flags was modified to also support bodyless NVs, the simplest possible change was made. However, this meant that there was no fast handling when one SV was an IV and the other a NV. Actually having this seems desirable since it avoids the need to allocate (and later release) an XPVIV or XPVNV body.
1 parent 7015de1 commit fbebf96

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

sv.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4201,7 +4201,7 @@ Perl_sv_setsv_flags(pTHX_ SV *dsv, SV* ssv, const I32 flags)
42014201
STATIC_ASSERT_STMT(SVt_IV == 1);
42024202
STATIC_ASSERT_STMT(SVt_NV == 2);
42034203
#if NVSIZE <= IVSIZE
4204-
if (both_type <= 2) {
4204+
if ((stype <= SVt_NV) & (dtype <= SVt_NV)) {
42054205
#else
42064206
if (both_type <= 1) {
42074207
#endif
@@ -4276,6 +4276,10 @@ Perl_sv_setsv_flags(pTHX_ SV *dsv, SV* ssv, const I32 flags)
42764276
return;
42774277
}
42784278

4279+
#if NVSIZE <= IVSIZE
4280+
both_type = (stype | dtype);
4281+
#endif
4282+
42794283
if (UNLIKELY(both_type == SVTYPEMASK)) {
42804284
if (SvIS_FREED(dsv)) {
42814285
Perl_croak(aTHX_ "panic: attempt to copy value %" SVf

0 commit comments

Comments
 (0)