* value.h (value_cnt_from_width): New function.
[pspp-builds.git] / src / data / value.h
index e3e3f0de4ce9fab2267f535cd919bfdbdc73ba1f..9e771b733fc43b9a59efb07f3ac0b28acac1b230 100644 (file)
 #define LOWEST second_lowest_value
 #define HIGHEST DBL_MAX
 
+/* Number of "union value"s required for a variable of the given
+   WIDTH. */
+static inline size_t
+value_cnt_from_width (int width)
+{
+  return width == 0 ? 1 : DIV_RND_UP (width, MAX_SHORT_STRING);
+}
+
 /* A numeric or short string value.
    Multiple consecutive values represent a long string. */
 union value