PATCH: Allow BITS_PER_UNIT != 8

Lars Brinkhoff lars.spam@nocrew.org
Tue Feb 13 06:49:00 GMT 2001


Lars Brinkhoff <lars.spam@nocrew.org> writes:
> The function get_mode_alignment() in stor-layout.c doesn't work if
> BITS_PER_UNIT isn't 2^n.

2001-02-13  lars brinkhoff  <lars@nocrew.org>

        * stor-layout.c (get_mode_alignment): Remove the restriction
        that BITS_PER_UNIT must be a power of 2.

Index: stor-layout.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/stor-layout.c,v
retrieving revision 1.93
diff -u -r1.93 stor-layout.c
--- stor-layout.c       2001/02/06 13:04:43     1.93
+++ stor-layout.c       2001/02/13 14:42:43
@@ -1815,10 +1815,11 @@
 get_mode_alignment (mode)
      enum machine_mode mode;
 {
-  unsigned int alignment = GET_MODE_UNIT_SIZE (mode) * BITS_PER_UNIT;
+  unsigned int alignment = GET_MODE_UNIT_SIZE (mode);

   /* Extract the LSB of the size.  */
   alignment = alignment & -alignment;
+  alignment *= BITS_PER_UNIT;

   alignment = MIN (BIGGEST_ALIGNMENT, MAX (1, alignment));
   return alignment;



More information about the Gcc-patches mailing list