[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [MiNT] struct align
On Sunday 11 January 2009, Miro Kropacek wrote:
> > No, the alignment is decided based on what the CPU requires and which
> > is faster.
> I see your point, I know all this stuff. I was wondering why gcc/68k does
> this -- for CPU >= 68020 (definitely for 060) is faster to align stuff on
> 4 bytes boundaries (16 bytes if reading bigger chunks).
Which CPU model you were specifying for the compiler?
> So either gcc is
> such smart and it sees I'm picking up values one-by-one in that order
> (but this doesn't explain that gap for 2 bytes align) or gcc simply
> should align it on 4 byte boundary when it's long variable. Or do you
> have any other explanation for it? I don't say gcc is wrong I just want
> to know the reason why it behaves in this way :)
I don't know, maybe it's a reasonable default compromise?
The whole data size affects the performance too (does it fit into cache) and
I think for that kind of stuff gcc is quite dumb and uses default values
(which programmer can override) which are reasonable for a wide variety of