summaryrefslogtreecommitdiff
path: root/gdb/utils.c
diff options
context:
space:
mode:
authorKevin Buettner <kevinb@redhat.com>2000-03-20 22:15:58 +0000
committerKevin Buettner <kevinb@redhat.com>2000-03-20 22:15:58 +0000
commit9b94eec884e236fc78eae25c866c7f65f2a8025d (patch)
treeccd360e9e5cd1864779461016399cb3b5f6a6325 /gdb/utils.c
parentca9dbbc0df4e75c9fc250db9bd4cc2d6cc908a54 (diff)
downloadgdb-9b94eec884e236fc78eae25c866c7f65f2a8025d.tar.gz
Fixes for floatformat_from_doublest().
Diffstat (limited to 'gdb/utils.c')
-rw-r--r--gdb/utils.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/gdb/utils.c b/gdb/utils.c
index a752f714c55..824dabedad5 100644
--- a/gdb/utils.c
+++ b/gdb/utils.c
@@ -2722,7 +2722,8 @@ floatformat_from_doublest (fmt, from, to)
unsigned char *uto = (unsigned char *) to;
memcpy (&dfrom, from, sizeof (dfrom));
- memset (uto, 0, fmt->totalsize / FLOATFORMAT_CHAR_BIT);
+ memset (uto, 0, (fmt->totalsize + FLOATFORMAT_CHAR_BIT - 1)
+ / FLOATFORMAT_CHAR_BIT);
if (dfrom == 0)
return; /* Result is zero */
if (dfrom != dfrom) /* Result is NaN */
@@ -2771,7 +2772,7 @@ floatformat_from_doublest (fmt, from, to)
mant_bits = mant_bits_left < 32 ? mant_bits_left : 32;
mant *= 4294967296.0;
- mant_long = (unsigned long) mant;
+ mant_long = ((unsigned long) mant) & 0xffffffffL;
mant -= mant_long;
/* If the integer bit is implicit, then we need to discard it.
@@ -2782,6 +2783,7 @@ floatformat_from_doublest (fmt, from, to)
&& fmt->intbit == floatformat_intbit_no)
{
mant_long <<= 1;
+ mant_long &= 0xffffffffL;
mant_bits -= 1;
}