Messages in this thread | | | Date | Sat, 12 Feb 2000 18:24:00 -0500 | From | willy@thepuffi ... | Subject | Re: [PATCH] isa_{read,write}{w,l} fixed |
| |
On Sat, Feb 12, 2000 at 12:14:40PM +0100, Philipp Rumpf wrote: > > Philipp's point is still valid though, u32 is only 2 byte aligned on > > Alan's point. My point was you could rely on gcc not padding structures > when you always explicitly padded to natural alignment boundaries. Eg > when you do struct { u16 s; u32 l; } you deserve to get burned, but when > you do struct { u16 s; u16 unused; u32 l; } you can expect gcc not to > be smart on you.
Alas, you can't. If accessing quantities of type short is exceptionally slow, then it may well be that the ABI decress Thou Shalt Pad. gcc has __attribute__(packed) to allow you to work around this.
Just do as the plan9'ers do and represent all externally visible data as an array of unsigned chars. It's difficult to get that wrong.
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/
| |