diff options
author | TAKAI Kousuke <62541129+t-a-k@users.noreply.github.com> | 2021-10-08 02:02:04 +0900 |
---|---|---|
committer | Tony Cook <tony@develop-help.com> | 2021-12-09 11:05:49 +1100 |
commit | 6f14d737160321a4a1a0db2950833b64a317d637 (patch) | |
tree | eb74f385c3e91f8bdf6176ba1b17d41c35734d46 | |
parent | 75122876d2e240d7aafe35db62c52dc639af3437 (diff) | |
download | perl-6f14d737160321a4a1a0db2950833b64a317d637.tar.gz |
Unify SETu() calls in pp_abs.
SETu() is a relatively complex macro and calling it in multiple places
will lead bloating of compiled code. Unifying them with intermediate
variable may save a few hundred bytes.
-rw-r--r-- | pp.c | 14 |
1 files changed, 9 insertions, 5 deletions
@@ -3033,27 +3033,31 @@ PP(pp_abs) SV * const sv = TOPs; /* This will cache the NV value if string isn't actually integer */ const IV iv = SvIV_nomg(sv); + UV uv; if (!SvOK(sv)) { - SETu(0); + uv = 0; + goto set_uv; } else if (SvIOK(sv)) { /* IVX is precise */ if (SvIsUV(sv)) { - SETu(SvUVX(sv)); /* force it to be numeric only */ + uv = SvUVX(sv); /* force it to be numeric only */ } else { if (iv >= 0) { - SETi(iv); + uv = (UV)iv; } else { if (iv != IV_MIN) { - SETi(-iv); + uv = (UV)-iv; } else { /* 2s complement assumption. Also, not really needed as IV_MIN and -IV_MIN should both be %100...00 and NV-able */ - SETu((UV)IV_MIN); + uv = (UV)IV_MIN; } } } + set_uv: + SETu(uv); } else{ const NV value = SvNV_nomg(sv); SETn(Perl_fabs(value)); |