summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTAKAI Kousuke <62541129+t-a-k@users.noreply.github.com>2021-10-08 02:02:04 +0900
committerTony Cook <tony@develop-help.com>2021-12-09 11:05:49 +1100
commit6f14d737160321a4a1a0db2950833b64a317d637 (patch)
treeeb74f385c3e91f8bdf6176ba1b17d41c35734d46
parent75122876d2e240d7aafe35db62c52dc639af3437 (diff)
downloadperl-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.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/pp.c b/pp.c
index f6734aec4a..25d3a319cd 100644
--- a/pp.c
+++ b/pp.c
@@ -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));