X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fdata%2Fsys-file-private.c;h=da485f5acf8c29acbba279704568f188081dd71e;hb=6999c6d125665923b52ae15cbad83d06c92a8875;hp=f544a810580e2c07cd454c1b47d4df2556856283;hpb=24a954d1a4faa977d763421136881378f4dd092c;p=pspp-builds.git diff --git a/src/data/sys-file-private.c b/src/data/sys-file-private.c index f544a810..da485f5a 100644 --- a/src/data/sys-file-private.c +++ b/src/data/sys-file-private.c @@ -40,4 +40,16 @@ sfm_width_to_bytes (int width) } } +/* Returns the number of "segments" used for writing case data + for a variable of the given WIDTH. A segment is a physical + variable in the system file that represents some piece of a + logical variable as seen by a PSPP user. Only very long + string variables have more than one segment. */ +int +sfm_width_to_segments (int width) +{ + assert (width >= 0); + return (width < MIN_VERY_LONG_STRING ? 1 + : DIV_RND_UP (width, EFFECTIVE_LONG_STRING_LENGTH)); +}