daily update
[deliverable/binutils-gdb.git] / gdb / doublest.c
index 2e0bdda884aa0295428eddbec60bf2767bf89e0b..7e8b34345f9cb5aea70128a6521b73a82e88df3e 100644 (file)
@@ -1,7 +1,7 @@
 /* Floating point routines for GDB, the GNU debugger.
 
    Copyright (C) 1986, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996,
-   1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2007, 2008, 2009
+   1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2007, 2008, 2009, 2010
    Free Software Foundation, Inc.
 
    This file is part of GDB.
@@ -66,6 +66,7 @@ get_field (const bfd_byte *data, enum floatformat_byteorders order,
         represents the number of bits from the end of our starting
         byte needed to get to bit 0. */
       int excess = FLOATFORMAT_CHAR_BIT - (total_len % FLOATFORMAT_CHAR_BIT);
+
       cur_byte = (total_len / FLOATFORMAT_CHAR_BIT) 
                  - ((start + len + excess) / FLOATFORMAT_CHAR_BIT);
       cur_bitshift = ((start + len + excess) % FLOATFORMAT_CHAR_BIT) 
@@ -190,6 +191,7 @@ convert_floatformat_to_doublest (const struct floatformat *fmt,
   if (kind == float_infinite || kind == float_nan)
     {
       double dto;
+
       floatformat_to_double (fmt, from, &dto);
       *to = (DOUBLEST) dto;
       return;
@@ -203,6 +205,7 @@ convert_floatformat_to_doublest (const struct floatformat *fmt,
   if (fmt->split_half)
     {
       DOUBLEST dtop, dbot;
+
       floatformat_to_doublest (fmt->split_half, ufrom, &dtop);
       /* Preserve the sign of 0, which is the sign of the top
         half.  */
@@ -292,6 +295,7 @@ put_field (unsigned char *data, enum floatformat_byteorders order,
   if (order == floatformat_little)
     {
       int excess = FLOATFORMAT_CHAR_BIT - (total_len % FLOATFORMAT_CHAR_BIT);
+
       cur_byte = (total_len / FLOATFORMAT_CHAR_BIT) 
                  - ((start + len + excess) / FLOATFORMAT_CHAR_BIT);
       cur_bitshift = ((start + len + excess) % FLOATFORMAT_CHAR_BIT) 
@@ -418,6 +422,7 @@ convert_doublest_to_floatformat (CONST struct floatformat *fmt,
         the result of converting to double.  */
       static volatile double dtop, dbot;
       DOUBLEST dtopnv, dbotnv;
+
       dtop = (double) dfrom;
       /* If the rounded top half is Inf, the bottom must be 0 not NaN
         or Inf.  */
@@ -479,6 +484,7 @@ convert_doublest_to_floatformat (CONST struct floatformat *fmt,
   while (mant_bits_left > 0)
     {
       unsigned long mant_long;
+
       mant_bits = mant_bits_left < 32 ? mant_bits_left : 32;
 
       mant *= 4294967296.0;
@@ -703,18 +709,21 @@ floatformat_to_doublest (const struct floatformat *fmt,
   if (fmt == host_float_format)
     {
       float val;
+
       memcpy (&val, in, sizeof (val));
       *out = val;
     }
   else if (fmt == host_double_format)
     {
       double val;
+
       memcpy (&val, in, sizeof (val));
       *out = val;
     }
   else if (fmt == host_long_double_format)
     {
       long double val;
+
       memcpy (&val, in, sizeof (val));
       *out = val;
     }
@@ -730,16 +739,19 @@ floatformat_from_doublest (const struct floatformat *fmt,
   if (fmt == host_float_format)
     {
       float val = *in;
+
       memcpy (out, &val, sizeof (val));
     }
   else if (fmt == host_double_format)
     {
       double val = *in;
+
       memcpy (out, &val, sizeof (val));
     }
   else if (fmt == host_long_double_format)
     {
       long double val = *in;
+
       memcpy (out, &val, sizeof (val));
     }
   else
@@ -764,7 +776,11 @@ static const struct floatformat *
 floatformat_from_length (struct gdbarch *gdbarch, int len)
 {
   const struct floatformat *format;
-  if (len * TARGET_CHAR_BIT == gdbarch_float_bit (gdbarch))
+
+  if (len * TARGET_CHAR_BIT == gdbarch_half_bit (gdbarch))
+    format = gdbarch_half_format (gdbarch)
+              [gdbarch_byte_order (gdbarch)];
+  else if (len * TARGET_CHAR_BIT == gdbarch_float_bit (gdbarch))
     format = gdbarch_float_format (gdbarch)
               [gdbarch_byte_order (gdbarch)];
   else if (len * TARGET_CHAR_BIT == gdbarch_double_bit (gdbarch))
@@ -778,8 +794,8 @@ floatformat_from_length (struct gdbarch *gdbarch, int len)
      both in processor and in memory.  
      The code below accepts the real bit size.  */ 
   else if ((gdbarch_long_double_format (gdbarch) != NULL)
-          && (len * TARGET_CHAR_BIT ==
-               gdbarch_long_double_format (gdbarch)[0]->totalsize))
+          && (len * TARGET_CHAR_BIT
+               == gdbarch_long_double_format (gdbarch)[0]->totalsize))
     format = gdbarch_long_double_format (gdbarch)
               [gdbarch_byte_order (gdbarch)];
   else
@@ -794,6 +810,7 @@ const struct floatformat *
 floatformat_from_type (const struct type *type)
 {
   struct gdbarch *gdbarch = get_type_arch (type);
+
   gdb_assert (TYPE_CODE (type) == TYPE_CODE_FLT);
   if (TYPE_FLOATFORMAT (type) != NULL)
     return TYPE_FLOATFORMAT (type)[gdbarch_byte_order (gdbarch)];
This page took 0.026775 seconds and 4 git commands to generate.