See if this makes MSVC happy.

It's complaining about an "overflow in constant arithmetic".  Neither
INFINITY nor NAN are specified by C90; C99 specifies that they are both
floats.  Until recently, Microsoft had no interest in C99; if the
version we're using supports C99's INFINITY and NAN, it should be OK to
assign them to a variable (no "arithmetic" involved), so I'm guessing
that the "arithmetic" in question is the use of conditional operators ?
and :, so I'm writing it as an if statement instead.

Change-Id: I532b9b5943be32e0897e4f03ac4e625ac41ee63b
Reviewed-on: https://code.wireshark.org/review/10215
Reviewed-by: Guy Harris <guy@alum.mit.edu>
This commit is contained in:
Guy Harris 2015-08-23 11:38:13 -07:00
parent 6b9a628e54
commit 4f68c52eda
1 changed files with 6 additions and 2 deletions

View File

@ -571,8 +571,12 @@ static float decode_half(const int half) {
val = ldexpf((float)mantissa, -24);
else if (exponent != 31)
val = ldexpf((float)(mantissa + 1024), exponent - 25);
else
val = mantissa == 0 ? INFINITY : NAN;
else {
if (mantissa == 0)
val = INFINITY;
else
val = NAN;
}
return half & 0x8000 ? -val : val;
}