X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fdata%2Fformat.c;fp=src%2Fdata%2Fformat.c;h=52206b0f539af86040e4de071d92431f526321dd;hb=52c54183e360053b1845e46cb96cd44a0cf96040;hp=55e166e817a0c075de9fab55c29a5ae4afab73c5;hpb=2ca3267c1110bbff675c560b19d02defb96ee2f9;p=pspp diff --git a/src/data/format.c b/src/data/format.c index 55e166e817..52206b0f53 100644 --- a/src/data/format.c +++ b/src/data/format.c @@ -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; +} /* Describes a display format. */ struct fmt_desc