summaryrefslogtreecommitdiff
path: root/inline.h
diff options
context:
space:
mode:
authorKarl Williamson <khw@cpan.org>2020-11-22 09:36:20 -0700
committerKarl Williamson <khw@cpan.org>2020-11-22 09:47:15 -0700
commitef0a8475fdfef2bfeb82df0df1e8cc211790721e (patch)
tree9134373de2a9124beead7b839d4abc5ce01aa1ff /inline.h
parent333238a72a681884a924eb094c6f4d337b82b540 (diff)
downloadperl-ef0a8475fdfef2bfeb82df0df1e8cc211790721e.tar.gz
Slience compiler warnings for NV, [IU]V compare
These were occurring on FreeBSD smokes. warning: implicit conversion from 'IV' (aka 'long') to 'double' changes value from 9223372036854775807 to 9223372036854775808 [-Wimplicit-int-float-conversion] 9223372036854775807 is IV_MAX. What needed to be done here was to use the NV containing IV_MAX+1, a value that already exists in perl.h In other instances, simply casting to an NV before doing the comparison with the NV was what was needed. This fixes #18328
Diffstat (limited to 'inline.h')
-rw-r--r--inline.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/inline.h b/inline.h
index 5ada1555d1..3b34ad4667 100644
--- a/inline.h
+++ b/inline.h
@@ -1980,7 +1980,7 @@ S_lossless_NV_to_IV(const NV nv, IV *ivp)
/* Written this way so that with an always-false NaN comparison we
* return false */
- if (!(LIKELY(nv >= IV_MIN) && LIKELY(nv <= IV_MAX))) {
+ if (!(LIKELY(nv >= (NV) IV_MIN) && LIKELY(nv < IV_MAX_P1))) {
return FALSE;
}