gdb: Move value_from_host_double into value.c and make more use of it
[deliverable/binutils-gdb.git] / gdb / value.c
index 50e47a936aa37d35574f94ab3950d2acfa53bddf..dc297dfe0f9efaf827c84b58107c1e4a2d87141b 100644 (file)
@@ -3430,6 +3430,19 @@ value_from_pointer (struct type *type, CORE_ADDR addr)
   return val;
 }
 
+/* Create and return a value object of TYPE containing the value D.  The
+   TYPE must be of TYPE_CODE_FLT, and must be large enough to hold D once
+   it is converted to target format.  */
+
+struct value *
+value_from_host_double (struct type *type, double d)
+{
+  struct value *value = allocate_value (type);
+  gdb_assert (TYPE_CODE (type) == TYPE_CODE_FLT);
+  target_float_from_host_double (value_contents_raw (value),
+                                value_type (value), d);
+  return value;
+}
 
 /* Create a value of type TYPE whose contents come from VALADDR, if it
    is non-null, and whose memory address (in the inferior) is
This page took 0.025176 seconds and 4 git commands to generate.