From: Ben Pfaff <blp@gnu.org>
Date: Thu, 21 Sep 2006 14:01:09 +0000 (+0000)
Subject: 	* variable.c: (width_to_bytes) Rephrase code for clarify.
X-Git-Tag: sav-api~1748
X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6836cbca31d72c075de04e80d937b704fae20394;p=pspp

	* variable.c: (width_to_bytes) Rephrase code for clarify.
---

diff --git a/src/data/ChangeLog b/src/data/ChangeLog
index c946325663..3086444287 100644
--- a/src/data/ChangeLog
+++ b/src/data/ChangeLog
@@ -1,3 +1,7 @@
+Thu Sep 21 07:00:30 2006  Ben Pfaff  <blp@gnu.org>
+
+	* variable.c: (width_to_bytes) Rephrase code for clarify.
+
 Sun Jul 16 19:52:03 2006  Ben Pfaff  <blp@gnu.org>
 
 	* format.c: (fmt_type_from_string) New function.
diff --git a/src/data/variable.c b/src/data/variable.c
index 435980e3f5..7a631a7365 100644
--- a/src/data/variable.c
+++ b/src/data/variable.c
@@ -356,30 +356,19 @@ dict_class_to_name (enum dict_class dict_class)
 int
 width_to_bytes(int width)
 {
-  const int chunks = width / EFFECTIVE_LONG_STRING_LENGTH ;
-  const int remainder = width - (chunks * EFFECTIVE_LONG_STRING_LENGTH) ;
-  int bytes, mod8;
-
   assert (width >= 0);
 
   if ( width == 0 ) 
     return MAX_SHORT_STRING ;
-
-  if ( width <= MAX_LONG_STRING) 
-    return MAX_SHORT_STRING * DIV_RND_UP(width, MAX_SHORT_STRING);
-
-
-  bytes =  remainder + (chunks * (MAX_LONG_STRING + 1) );
-
-  /* Round up to the nearest 8 */
-  mod8 = bytes % MAX_SHORT_STRING;
-
-  if ( mod8 ) 
-    bytes += MAX_SHORT_STRING - mod8;
-
-  assert( bytes % MAX_SHORT_STRING == 0 );
-
-  return bytes;
+  else if (width <= MAX_LONG_STRING) 
+    return ROUND_UP (width, MAX_SHORT_STRING);
+  else 
+    {
+      int chunks = width / EFFECTIVE_LONG_STRING_LENGTH ;
+      int remainder = width % EFFECTIVE_LONG_STRING_LENGTH ;
+      int bytes = remainder + (chunks * (MAX_LONG_STRING + 1) );
+      return ROUND_UP (bytes, MAX_SHORT_STRING); 
+    }
 }