From 6f14d737160321a4a1a0db2950833b64a317d637 Mon Sep 17 00:00:00 2001 From: TAKAI Kousuke <62541129+t-a-k@users.noreply.github.com> Date: Fri, 8 Oct 2021 02:02:04 +0900 Subject: 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. --- pp.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'pp.c') 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)); -- cgit v1.2.1