On Mon, Apr 27, 2015 at 07:34:01AM -0700, suigin wrote:
> As you can see, it's actually 2 bytes less. This is because a struct
> is usually aligned to the maximum alignment of all fields. A 16-bit
> ushort has a 2-byte alignment on x86_64, so this forces the struct
> to also have an alignment of 2-bytes, and thus it has to insert two
> extra padding bytes at the end of the struct to maintain the alignment
> across an array of these structs.
Sorry, there aren't actually two extra padding bytes, even though the
struct is two bytes longer in length. Don't know what I was thinking.
Time for a coffee.
Anyway, you get the idea.
Received on Mon Apr 27 2015 - 17:29:25 CEST