pxd: initial work
[pspp] / src / data / format.c
index 55e166e817a0c075de9fab55c29a5ae4afab73c5..52206b0f539af86040e4de071d92431f526321dd 100644 (file)
@@ -558,6 +558,22 @@ fmt_change_decimals (struct fmt_spec *fmt, int decimals, enum fmt_use use)
   fmt->d = decimals;
   fmt_fix (fmt, use);
 }
+
+unsigned int
+fmt_to_uint (const struct fmt_spec *fmt)
+{
+  return (fmt_to_io (fmt->type) << 24) | (fmt->w << 8) | fmt->d;
+}
+
+bool
+fmt_from_uint (struct fmt_spec *fmt, unsigned int uint)
+{
+  if (!fmt_from_io (uint >> 24, &fmt->type))
+    return false;
+  fmt->w = (uint >> 8) & 0xffff;
+  fmt->d = uint & 0xff;
+  return true;
+}
 \f
 /* Describes a display format. */
 struct fmt_desc