diff options
author | Father Chrysostomos <sprout@cpan.org> | 2013-08-25 01:30:18 -0700 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2013-08-25 06:41:15 -0700 |
commit | 4d91ecccee1825237c33d0a97bebddc384d58dc2 (patch) | |
tree | b204798c9348539c95045d923914731d9c76eb67 /pp_ctl.c | |
parent | 1522d188b83c42df1e2b65084cfe4fb70415b67b (diff) | |
download | perl-4d91ecccee1825237c33d0a97bebddc384d58dc2.tar.gz |
pp_ctl.c:pp_flop: Avoid redundant SvNV calls
Calling SvNV on an SV that is IOK is unnecessary, and results in an
extra function call if the SV is not NOKp. If an NV is out of range
and has been used as an int, it will be IOKp but not IOK.
Diffstat (limited to 'pp_ctl.c')
-rw-r--r-- | pp_ctl.c | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -1230,8 +1230,10 @@ PP(pp_flop) if (RANGE_IS_NUMERIC(left,right)) { IV i, j; IV max; - if ((SvOK(left) && SvNV_nomg(left) < IV_MIN) || - (SvOK(right) && SvNV_nomg(right) > IV_MAX)) + if ((SvOK(left) && !SvIOK(left) && SvNV_nomg(left) < IV_MIN) || + (SvOK(right) && (SvIOK(right) + ? SvIsUV(right) && SvUV(right) > IV_MAX + : SvNV_nomg(right) > IV_MAX))) DIE(aTHX_ "Range iterator outside integer range"); i = SvIV_nomg(left); max = SvIV_nomg(right); |