From: Jarkko Hietaniemi Date: Thu, 25 Sep 2014 14:47:14 +0000 (-0400) Subject: infnan: in pack, first test for the unlikely infnan-ness. X-Git-Tag: v5.21.5~367 X-Git-Url: https://perl5.git.perl.org/perl5.git/commitdiff_plain/84441873284d94d2b1e6a76fda24795fe5cf45f7 infnan: in pack, first test for the unlikely infnan-ness. Also make the type I32, not char. --- diff --git a/pp_pack.c b/pp_pack.c index aa3e790..7928315 100644 --- a/pp_pack.c +++ b/pp_pack.c @@ -2167,13 +2167,16 @@ S_pack_rec(pTHX_ SV *cat, tempsym_t* symptr, SV **beglist, SV **endlist ) fromstr = PEEKFROM; if (SvNOK(fromstr)) { const NV nv = SvNV(fromstr); - const char c = TYPE_NO_MODIFIERS(datumtype); - if (Perl_isinfnan(nv) && !strchr("fdFD", c)) { - if (c == 'w') - Perl_croak(aTHX_ "Cannot compress %"NVgf" in pack", nv); - else - Perl_croak(aTHX_ "Cannot pack %"NVgf" with '%c'", - nv, (int) c); + if (UNLIKELY(Perl_isinfnan(nv))) { + const I32 c = TYPE_NO_MODIFIERS(datumtype); + if (!strchr("fdFD", (char)c)) { /* floats are okay */ + if (c == 'w') + Perl_croak(aTHX_ + "Cannot compress %"NVgf" in pack", nv); + else + Perl_croak(aTHX_ "Cannot pack %"NVgf" with '%c'", + nv, (int) c); + } } }