summaryrefslogtreecommitdiff
path: root/pp.c
diff options
context:
space:
mode:
Diffstat (limited to 'pp.c')
-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));