(i960_round_tree): Correct conversion of bits to bytes to round up to nearest byte.
authorJim Wilson <wilson@gcc.gnu.org>
Mon, 28 Sep 1992 21:11:48 +0000 (14:11 -0700)
committerJim Wilson <wilson@gcc.gnu.org>
Mon, 28 Sep 1992 21:11:48 +0000 (14:11 -0700)
(i960_round_tree): Correct conversion of bits to bytes to
round up to nearest byte.
(i960_round_align): Likewise.

From-SVN: r2271

gcc/config/i960/i960.c

index 82342cc3e3876c8710e441e3382dc7ea7789178f..0f4e5ae2a7b96392bdb296f78aef1ed0cfa6ea5e 100644 (file)
@@ -2044,13 +2044,14 @@ tree
 i960_round_size (tsize)
      tree tsize;
 {
-  int size, align;
+  int size, byte_size, align;
 
   if (TREE_CODE (tsize) != INTEGER_CST)
     return tsize;
 
   size = TREE_INT_CST_LOW (tsize);
-  align = i960_object_bytes_bitalign (size / BITS_PER_UNIT);
+  byte_size = (size + BITS_PER_UNIT - 1) / BITS_PER_UNIT;
+  align = i960_object_bytes_bitalign (byte_size);
 
   /* Handle #pragma align.  */
   if (align > i960_maxbitalignment)
@@ -2069,11 +2070,13 @@ i960_round_align (align, tsize)
      int align;
      tree tsize;
 {
+  int byte_size;
+
   if (TREE_CODE (tsize) != INTEGER_CST)
     return align;
 
-  align = i960_object_bytes_bitalign (TREE_INT_CST_LOW (tsize)
-                                     / BITS_PER_UNIT);
+  byte_size = (TREE_INT_CST_LOW (tsize) + BITS_PER_UNIT - 1) / BITS_PER_UNIT;
+  align = i960_object_bytes_bitalign (byte_size);
   return align;
 }
 \f