([BinaryCStream -encodeValueOfCType:at:withName:name]): Use

intermediate float value.
([BinaryCStream -decodeValueOfCType:at:withName:]): Likewise.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@1920 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
mccallum 1996-10-31 20:47:42 +00:00
parent 32b96974b1
commit a449b8c087

View file

@ -222,11 +222,13 @@ static int debug_binary_coder = 0;
case _C_FLT: case _C_FLT:
{ {
float fvalue;
double value; double value;
int exponent, mantissa; int exponent, mantissa;
short exponent_encoded; short exponent_encoded;
memcpy (&value, d, sizeof (float)); memcpy (&fvalue, d, sizeof (float));
value = fvalue;
/* Get the exponent */ /* Get the exponent */
value = frexp (value, &exponent); value = frexp (value, &exponent);
exponent_encoded = exponent; exponent_encoded = exponent;
@ -386,6 +388,7 @@ static int debug_binary_coder = 0;
short exponent; short exponent;
int mantissa; int mantissa;
double value; double value;
float fvalue;
/* Decode the exponent and mantissa. */ /* Decode the exponent and mantissa. */
READ_SIGNED_TYPE (&exponent, short, ntohs); READ_SIGNED_TYPE (&exponent, short, ntohs);
@ -394,7 +397,8 @@ static int debug_binary_coder = 0;
value = mantissa / FLOAT_FACTOR; value = mantissa / FLOAT_FACTOR;
value = ldexp (value, exponent); value = ldexp (value, exponent);
/* Put the double into the requested memory location as a float */ /* Put the double into the requested memory location as a float */
memcpy (d, &value, sizeof (float)); fvalue = value;
memcpy (d, &fvalue, sizeof (float));
break; break;
} }