svn commit: r280397 - stable/9/lib/msun/src
Pedro F. Giffuni
pfg at FreeBSD.org
Mon Mar 23 20:02:17 UTC 2015
Author: pfg
Date: Mon Mar 23 20:02:16 2015
New Revision: 280397
URL: https://svnweb.freebsd.org/changeset/base/280397
Log:
MFC r277948:
msun: use previously ignored "in" value.
This fixes evaluation of exceptional values in scalblnl().
While here, simplify the code as suggested by Bruce Evans.
Reported by: clang static analyzer
Modified:
stable/9/lib/msun/src/s_scalbln.c
Directory Properties:
stable/9/lib/msun/ (props changed)
Modified: stable/9/lib/msun/src/s_scalbln.c
==============================================================================
--- stable/9/lib/msun/src/s_scalbln.c Mon Mar 23 20:00:35 2015 (r280396)
+++ stable/9/lib/msun/src/s_scalbln.c Mon Mar 23 20:02:16 2015 (r280397)
@@ -35,13 +35,7 @@ scalbln (double x, long n)
{
int in;
- in = (int)n;
- if (in != n) {
- if (n > 0)
- in = INT_MAX;
- else
- in = INT_MIN;
- }
+ in = (n > INT_MAX) ? INT_MAX : (n < INT_MIN) ? INT_MIN : n;
return (scalbn(x, in));
}
@@ -50,13 +44,7 @@ scalblnf (float x, long n)
{
int in;
- in = (int)n;
- if (in != n) {
- if (n > 0)
- in = INT_MAX;
- else
- in = INT_MIN;
- }
+ in = (n > INT_MAX) ? INT_MAX : (n < INT_MIN) ? INT_MIN : n;
return (scalbnf(x, in));
}
@@ -65,12 +53,6 @@ scalblnl (long double x, long n)
{
int in;
- in = (int)n;
- if (in != n) {
- if (n > 0)
- in = INT_MAX;
- else
- in = INT_MIN;
- }
- return (scalbnl(x, (int)n));
+ in = (n > INT_MAX) ? INT_MAX : (n < INT_MIN) ? INT_MIN : n;
+ return (scalbnl(x, in));
}
More information about the svn-src-stable-9
mailing list