pspp-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Pspp-cvs] pspp/src/data ChangeLog variable.c


From: Ben Pfaff
Subject: [Pspp-cvs] pspp/src/data ChangeLog variable.c
Date: Thu, 21 Sep 2006 14:01:09 +0000

CVSROOT:        /cvsroot/pspp
Module name:    pspp
Changes by:     Ben Pfaff <blp> 06/09/21 14:01:09

Modified files:
        src/data       : ChangeLog variable.c 

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

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/pspp/src/data/ChangeLog?cvsroot=pspp&r1=1.61&r2=1.62
http://cvs.savannah.gnu.org/viewcvs/pspp/src/data/variable.c?cvsroot=pspp&r1=1.9&r2=1.10

Patches:
Index: ChangeLog
===================================================================
RCS file: /cvsroot/pspp/pspp/src/data/ChangeLog,v
retrieving revision 1.61
retrieving revision 1.62
diff -u -b -r1.61 -r1.62
--- ChangeLog   18 Jul 2006 04:57:01 -0000      1.61
+++ ChangeLog   21 Sep 2006 14:01:09 -0000      1.62
@@ -1,3 +1,7 @@
+Thu Sep 21 07:00:30 2006  Ben Pfaff  <address@hidden>
+
+       * variable.c: (width_to_bytes) Rephrase code for clarify.
+
 Sun Jul 16 19:52:03 2006  Ben Pfaff  <address@hidden>
 
        * format.c: (fmt_type_from_string) New function.

Index: variable.c
===================================================================
RCS file: /cvsroot/pspp/pspp/src/data/variable.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -b -r1.9 -r1.10
--- variable.c  8 Jul 2006 03:05:51 -0000       1.9
+++ variable.c  21 Sep 2006 14:01:09 -0000      1.10
@@ -356,30 +356,19 @@
 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); 
+    }
 }
 
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]