2007-11-07 Markus Deuling <deuling@de.ibm.com>
[deliverable/binutils-gdb.git] / gdb / value.c
index 7085ec11f75690f3fb4218085119eac9582b3384..89759b8f00ab30b2a45cf786d65201f3384d4801 100644 (file)
@@ -34,6 +34,7 @@
 #include "gdb_assert.h"
 #include "regcache.h"
 #include "block.h"
+#include "dfp.h"
 
 /* Prototypes for exported functions. */
 
@@ -1641,6 +1642,27 @@ value_from_double (struct type *type, DOUBLEST num)
   return val;
 }
 
+struct value *
+value_from_decfloat (struct type *expect_type, struct type *type,
+                     gdb_byte decbytes[16])
+{
+  struct value *val = allocate_value (type);
+  int len = TYPE_LENGTH (type);
+
+  if (expect_type)
+    {
+      int expect_len = TYPE_LENGTH (expect_type);
+      char decstr[128];
+      int real_len;
+
+      decimal_to_string (decbytes, len, decstr);
+      decimal_from_string (decbytes, expect_len, decstr);
+    }
+
+  memcpy (value_contents_raw (val), decbytes, len);
+  return val;
+}
+
 struct value *
 coerce_ref (struct value *arg)
 {
This page took 0.023699 seconds and 4 git commands to generate.