msun: use previously ignored value.

This fixes evaluation of exceptional values in scalblnl().
While here, simplify the code as suggested by Bruce Evans.

Reported by:	clang static analyzer
MFC after:	1 week
This commit is contained in:
Pedro F. Giffuni 2015-01-30 19:19:03 +00:00
parent 09a4a1f2d8
commit 311449a4e3

View File

@ -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));
}