2011-01-05 Michael Snyder <msnyder@vmware.com>
[deliverable/binutils-gdb.git] / gdb / doublest.c
index 0dc09ab9b9b9a97c3c5b94b0bea565cf60cfb4c5..2a118a333f2b2a011fdae178f1dd226bbda70658 100644 (file)
@@ -1,8 +1,8 @@
 /* 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, 2010
-   Free Software Foundation, Inc.
+   1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2007, 2008, 2009, 2010,
+   2011 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -355,9 +355,10 @@ ldfrexp (long double value, int *eptr)
   long double tmp;
   int exp;
 
-  /* Unfortunately, there are no portable functions for extracting the exponent
-     of a long double, so we have to do it iteratively by multiplying or dividing
-     by two until the fraction is between 0.5 and 1.0.  */
+  /* Unfortunately, there are no portable functions for extracting the
+     exponent of a long double, so we have to do it iteratively by
+     multiplying or dividing by two until the fraction is between 0.5
+     and 1.0.  */
 
   if (value < 0.0l)
     value = -value;
@@ -699,7 +700,8 @@ floatformat_mantissa (const struct floatformat *fmt,
 
 static const struct floatformat *host_float_format = GDB_HOST_FLOAT_FORMAT;
 static const struct floatformat *host_double_format = GDB_HOST_DOUBLE_FORMAT;
-static const struct floatformat *host_long_double_format = GDB_HOST_LONG_DOUBLE_FORMAT;
+static const struct floatformat *host_long_double_format
+  = GDB_HOST_LONG_DOUBLE_FORMAT;
 
 void
 floatformat_to_doublest (const struct floatformat *fmt,
@@ -777,7 +779,10 @@ 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))
@@ -921,7 +926,8 @@ _initialize_doublest (void)
   floatformat_ieee_single[BFD_ENDIAN_BIG] = &floatformat_ieee_single_big;
   floatformat_ieee_double[BFD_ENDIAN_LITTLE] = &floatformat_ieee_double_little;
   floatformat_ieee_double[BFD_ENDIAN_BIG] = &floatformat_ieee_double_big;
-  floatformat_arm_ext[BFD_ENDIAN_LITTLE] = &floatformat_arm_ext_littlebyte_bigword;
+  floatformat_arm_ext[BFD_ENDIAN_LITTLE]
+    = &floatformat_arm_ext_littlebyte_bigword;
   floatformat_arm_ext[BFD_ENDIAN_BIG] = &floatformat_arm_ext_big;
   floatformat_ia64_spill[BFD_ENDIAN_LITTLE] = &floatformat_ia64_spill_little;
   floatformat_ia64_spill[BFD_ENDIAN_BIG] = &floatformat_ia64_spill_big;
This page took 0.025174 seconds and 4 git commands to generate.