From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Nigel Roles" To: <9fans@cse.psu.edu> Subject: RE: [9fans] struct problems Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit In-Reply-To: <20030507053411.GZ36080@cassie.foobarbaz.net> Date: Wed, 7 May 2003 06:36:51 +0100 Topicbox-Message-UUID: a0f1cb46-eacb-11e9-9e20-41e7f4b1d025 structs and unions are aligned on 4 byte boundaries. bit fields are never portable. are you sure they will work on any Plan 9 platform (not just x86)? > -----Original Message----- > From: 9fans-admin@cse.psu.edu [mailto:9fans-admin@cse.psu.edu]On Behalf > Of Christopher Nielsen > Sent: 07 May 2003 06:34 > To: 9fans@cse.psu.edu > Subject: Re: [9fans] struct problems > > > I forgot to add that my guess as to what is happening > is due to alignment issues. > > On Tue, May 06, 2003 at 09:36:33PM -0700, Christopher Nielsen wrote: > > I've been working on 48-bit LBA support for ATA, and > > I've run into something peculiar. I decided to rewrite > > the identify array as a struct of bit fields for better > > readability. As it turns out, the struct is 16 bytes > > bigger than expected, which is causing all sorts of > > trouble with accessing the fields properly. I am pretty > > sure I copied all the fields correctly; the struct > > should be 512 bytes, but it's 528 bytes. Below is the > > struct definition for folks to look at. I am in the > > process of rooting out where the extra bytes are > > coming from, but if someone can provide some insight, > > it would save me some time. > > -- > Christopher Nielsen > "They who can give up essential liberty for temporary > safety, deserve neither liberty nor safety." --Benjamin Franklin