+ memset (w->data[w->data_cnt], ' ', 8);
+ memcpy (w->data[w->data_cnt], data, size);
+ w->data_cnt++;
+}
+\f
+/* Writes 32-bit integer X to the output file for writer W. */
+static void
+write_int (struct sfm_writer *w, int32_t x)
+{
+ write_bytes (w, &x, sizeof x);
+}
+
+/* Converts NATIVE to the 64-bit format used in output files in
+ OUTPUT. */
+static inline void
+convert_double_to_output_format (double native, uint8_t output[8])
+{
+ /* If "double" is not a 64-bit type, then convert it to a
+ 64-bit type. Otherwise just copy it. */
+ if (FLOAT_NATIVE_DOUBLE != FLOAT_NATIVE_64_BIT)
+ float_convert (FLOAT_NATIVE_DOUBLE, &native, FLOAT_NATIVE_64_BIT, output);
+ else
+ memcpy (output, &native, sizeof native);
+}
+
+/* Writes floating-point number X to the output file for writer
+ W. */
+static void
+write_float (struct sfm_writer *w, double x)
+{
+ uint8_t output[8];
+ convert_double_to_output_format (x, output);
+ write_bytes (w, output, sizeof output);
+}
+
+/* Writes contents of VALUE with the given WIDTH to W, padding
+ with zeros to a multiple of 8 bytes.
+ To avoid a branch, and because we don't actually need to
+ support it, WIDTH must be no bigger than 8. */
+static void
+write_value (struct sfm_writer *w, const union value *value, int width)
+{
+ assert (width <= 8);
+ if (width == 0)
+ write_float (w, value->f);
+ else
+ {
+ write_bytes (w, value_str (value, width), width);
+ write_zeros (w, 8 - width);