Boston Linux & Unix (BLU) Home | Calendar | Mail Lists | List Archives | Desktop SIG | Hardware Hacking SIG
Wiki | Flickr | PicasaWeb | Video | Maps & Directions | Installfests | Keysignings
Linux Cafe | Meeting Notes | Blog | Linux Links | Bling | About BLU

BLU Discuss list archive


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

endian dilemma



"Derek D. Martin" <ddm at pizzashack.org> writes:

> Am I counting wrong?
> 
> > struct {
> > 	char a;   /* 1 byte */
> > 	long b;   /* 8 bytes */
> > };
> > The size of the struct on a 32 bit CISC system might be 9 bytes, but on a 
> > 32 bit RISC would be 8 bytes long, because field b must be aligned on a 32 
> > bit boundary.
> 
> How does one fit 9 bytes into 8 bytes?  Wouldn't it have to be 12
> bytes?

I can certainly see how this struct could be either 5, 6, or 8 on a
32-bit system.  I'm not sure where 9 comes from.  On a 64-bit system I
can see it being 9, 10, 12, or 16 bytes...

-derek

-- 
       Derek Atkins, SB '93 MIT EE, SM '95 MIT Media Laboratory
       Member, MIT Student Information Processing Board  (SIPB)
       URL: http://web.mit.edu/warlord/    PP-ASEL-IA     N1NWH
       warlord at MIT.EDU                        PGP key available




BLU is a member of BostonUserGroups
BLU is a member of BostonUserGroups
We also thank MIT for the use of their facilities.

Valid HTML 4.01! Valid CSS!



Boston Linux & Unix / webmaster@blu.org