diff options
author | Jarkko Hietaniemi <jhi@iki.fi> | 2014-09-21 21:53:24 -0400 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 2014-09-22 21:01:43 -0400 |
commit | d3475fb81a1317499d42d46a16d7a21789b26667 (patch) | |
tree | 7a8c4046f54496e79cae8dfb38436a9b62575ead /pp_pack.c | |
parent | b15c1b561a4d9a6ec5ecdf68b69fda7ef7d09cb7 (diff) | |
download | perl-d3475fb81a1317499d42d46a16d7a21789b26667.tar.gz |
No point in pack 'w' for inf/nan.
(For inf, the existing code already did this, slowly.)
Diffstat (limited to 'pp_pack.c')
-rw-r--r-- | pp_pack.c | 7 |
1 files changed, 6 insertions, 1 deletions
@@ -2900,12 +2900,17 @@ S_pack_rec(pTHX_ SV *cat, tempsym_t* symptr, SV **beglist, SV **endlist ) char buf[1 + (int)((308 + 1) / 2)]; /* valid C */ #endif char *in = buf + sizeof(buf); + static const char S_cannot_compress[] = + "Cannot compress integer in pack"; + + if (Perl_isinfnan(anv)) + Perl_croak(aTHX_ S_cannot_compress); anv = Perl_floor(anv); do { const NV next = Perl_floor(anv / 128); if (in <= buf) /* this cannot happen ;-) */ - Perl_croak(aTHX_ "Cannot compress integer in pack"); + Perl_croak(aTHX_ S_cannot_compress); *--in = (unsigned char)(anv - (next * 128)) | 0x80; anv = next; } while (anv > 0); |