forked from osmocom/wireshark
Rename variable to avoid collisions with math.h's exp().
Spell out "mantissa" while we're at it. Change-Id: I47ddb9882f45ef58a6f7101818683e68bc54983b Reviewed-on: https://code.wireshark.org/review/10211 Reviewed-by: Guy Harris <guy@alum.mit.edu>
This commit is contained in:
parent
0b03543cbb
commit
a451c603df
|
@ -563,16 +563,16 @@ dissect_cbor_tag(tvbuff_t *tvb, packet_info *pinfo, proto_tree *cbor_tree, gint
|
|||
|
||||
/* based on code from rfc7049 appendix-D */
|
||||
static float decode_half(const int half) {
|
||||
int exp = (half >> 10) & 0x1f;
|
||||
int mant = half & 0x3ff;
|
||||
int exponent = (half >> 10) & 0x1f;
|
||||
int mantissa = half & 0x3ff;
|
||||
float val;
|
||||
|
||||
if (exp == 0)
|
||||
val = ldexpf((float)mant, -24);
|
||||
else if (exp != 31)
|
||||
val = ldexpf((float)(mant + 1024), exp - 25);
|
||||
if (exponent == 0)
|
||||
val = ldexpf((float)mantissa, -24);
|
||||
else if (exponent != 31)
|
||||
val = ldexpf((float)(mantissa + 1024), exponent - 25);
|
||||
else
|
||||
val = mant == 0 ? INFINITY : NAN;
|
||||
val = mantissa == 0 ? INFINITY : NAN;
|
||||
return half & 0x8000 ? -val : val;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue