Skip to content

Commit

Permalink
formats/uef_cas.cpp: Fixed regression reading floating-point values.
Browse files Browse the repository at this point in the history
  • Loading branch information
cuavas committed Sep 27, 2023
1 parent 1eba9aa commit 6267f53
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/lib/formats/uef_cas.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,13 +96,13 @@ static float get_uef_float( const uint8_t *Float)
was the first byte read from the UEF, Float[1] the second, etc */

/* decode mantissa */
Mantissa = get_u24be(&Float[0]) | 0x800000;
Mantissa = get_u24le(&Float[0]) | 0x800000;

Result = (float)Mantissa;
Result = (float)ldexp(Result, -23);

/* decode exponent */
Exponent = (get_u16be(&Float[2])&0x7f80) >> 7;
Exponent = (get_u16le(&Float[2])&0x7f80) >> 7;
Exponent -= 127;
Result = (float)ldexp(Result, Exponent);

Expand Down

0 comments on commit 6267f53

Please sign in to comment.