From: "Stefan Monnier" <monnier@di.epfl.ch>
Subject: Re: Funny alignment with structures ?
Date: 7 Dec 1994 14:50:43 GMT [thread overview]
Message-ID: <3c4i43$mjk@info.epfl.ch> (raw)
In-Reply-To: D0DJ7u.2A4@un.seqeb.gov.au
In article <D0DJ7u.2A4@un.seqeb.gov.au>,
Anthony <al012@svtstu.seqeb.gov.au> wrote:
] I thought the alignment would be like this:
]
] 16bits 16bits 16bits 16bits
] _______________________________________________________________
] |major v|minor v| flags | entry_size | entry_count |
] ----------------------------------------------------------------
] | next_entry | start_par | end_par | next_par |
] ----------------------------------------------------------------
] | next_offset | seqno | updates |
] ----------------------------------------------------------------
] ..........
here, seqno is not on a 32bit boundary. It's hence incorrectly aligned.
] but I am getting this alignment
]
] 16bits 16bits 16bits 16bits
] _______________________________________________________________
] |major v|minor v| flags | entry_size | entry_count |
] ----------------------------------------------------------------
] | next_entry | start_par | end_par | next_par |
] ----------------------------------------------------------------
] | next_offset | not used |
] ----------------------------------------------------------------
] | seqno | updates | .......
] --------------------------------------------------
] ..........
That's a surprise, I would expect:
| next_offset | not used | seqno |
Since this is sufficient for seqno to be 32bits aligned. Are you sure
of the alignment you suggested ?
Anyway, you can't really avoid it. Either you move things around so
that the compiler doesn't have to insert blanks, or you split the
seqno field into two 16bits fields. Unless there's a magic compiler
option, but that would be a surprise !
Stefan
--
--------------------------------------------------------------------
-- Suicidez-vous jeune, vous profiterez plus longtemps de la mort --
--------------------------------------------------------------------
prev parent reply other threads:[~1994-12-07 14:50 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
1994-12-06 5:28 Funny alignment with structures ? Anthony
1994-12-06 14:32 ` Steve Thompson
1994-12-06 19:20 ` Alan Rollow - Dr. File System's Home for Wayward Inodes.
1994-12-07 6:56 ` Tim Bartley
1994-12-07 23:58 ` Anthony
1994-12-08 1:31 ` Anthony
1994-12-07 14:50 ` Stefan Monnier [this message]
read-only archive
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox