aboutsummaryrefslogtreecommitdiff
path: root/gdb/utils.c
diff options
context:
space:
mode:
authorStu Grossman <grossman@cygnus>1996-04-13 21:33:59 +0000
committerStu Grossman <grossman@cygnus>1996-04-13 21:33:59 +0000
commit449abd890017f4db4e9842a492e5be44610ecfaa (patch)
tree493484d6e0d941a2a50f343575ca4591f893b05c /gdb/utils.c
parent9898b3b7c77ed601f60977ea2a7715cfcf17f4ec (diff)
downloadgdb-449abd890017f4db4e9842a492e5be44610ecfaa.zip
gdb-449abd890017f4db4e9842a492e5be44610ecfaa.tar.gz
gdb-449abd890017f4db4e9842a492e5be44610ecfaa.tar.bz2
* remote-nindy.c (nindy_open): Acquire more target state so that
user can attach to a previously running program. * (nindy_fetch_registers nindy_store_registers): Get rid of fp conversion code. That's all handled in {extract store}_floating now. * utils.c (floatformat_to_double): Don't bias exponent when handling zero's, denorms or NaNs. * config/i960/tm-i960.h (REGISTER_CONVERT_TO_VIRTUAL REGISTER_CONVERT_TO_RAW): Change to using DOUBLST and FLOATFORMAT_TO/FROM_DOUBLEST macros. * config/i960/tm-nindy960.h: Undefine REGISTER_CONVERT_TO_VIRTUAL, REGISTER_CONVERT_TO_RAW, and REGISTER_CONVERTIBLE. These are no longer necessary now that all the magic happens in extract/store_floating.
Diffstat (limited to 'gdb/utils.c')
-rw-r--r--gdb/utils.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/gdb/utils.c b/gdb/utils.c
index 22e511c..c703ba4 100644
--- a/gdb/utils.c
+++ b/gdb/utils.c
@@ -2035,6 +2035,7 @@ floatformat_to_long_double (fmt, from, to)
unsigned long mant;
unsigned int mant_bits, mant_off;
int mant_bits_left;
+ int special_exponent; /* It's a NaN, denorm or zero */
exponent = get_field (ufrom, fmt->byteorder, fmt->totalsize,
fmt->exp_start, fmt->exp_len);
@@ -2045,7 +2046,12 @@ floatformat_to_long_double (fmt, from, to)
mant_bits_left = fmt->man_len;
mant_off = fmt->man_start;
dto = 0.0;
- exponent -= fmt->exp_bias;
+
+ special_exponent = exponent == 0 || exponent == fmt->exp_nan;
+
+/* Don't bias zero's, denorms or NaNs. */
+ if (!special_exponent)
+ exponent -= fmt->exp_bias;
/* Build the result algebraically. Might go infinite, underflow, etc;
who cares. */
@@ -2053,10 +2059,11 @@ floatformat_to_long_double (fmt, from, to)
/* If this format uses a hidden bit, explicitly add it in now. Otherwise,
increment the exponent by one to account for the integer bit. */
- if (fmt->intbit == floatformat_intbit_no)
- dto = ldexp (1.0, exponent);
- else
- exponent++;
+ if (!special_exponent)
+ if (fmt->intbit == floatformat_intbit_no)
+ dto = ldexp (1.0, exponent);
+ else
+ exponent++;
while (mant_bits_left > 0)
{
@@ -2074,7 +2081,7 @@ floatformat_to_long_double (fmt, from, to)
/* Negate it if negative. */
if (get_field (ufrom, fmt->byteorder, fmt->totalsize, fmt->sign_start, 1))
dto = -dto;
- memcpy (to, &dto, sizeof (dto));
+ *to = dto;
}
static void put_field PARAMS ((unsigned char *, enum floatformat_byteorders,