This is the mail archive of the ecos-discuss@sourceware.org mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: Re: pragma pack


 

-----Original Message-----
From: ecos-discuss-owner@ecos.sourceware.org
[mailto:ecos-discuss-owner@ecos.sourceware.org] On Behalf Of Alexandre
Sent: Donnerstag, 10. Januar 2008 10:43
To: Paul D. DeRocco
Cc: ecos-discuss@ecos.sourceware.org
Subject: Re: [ECOS] Re: pragma pack

> Actually i had some problems accessing my packed structures without
> flows, I think that may help resolve things a bit.
> Eg with things like that:
> 
> cyg_uint8 i = 0;
> struct s_pelco_pattern_array a;
> 
> a.command2_byte = i++;
> a.data3 = i++;
> a.data4 = i++;
> a.timestamp = i;
> 
> I finish having a structure which looks like this in memory:
> 
> cm2: 0x00
> data3: 0x01
> data4: 0x02
> ts: 0x0300
> 
> Which is really not what i want to have eventually.
> 

I would say this looks correct.
Maybe you thought there must be 0x0003 in the last one?

But if you have a little endian CPU it swaps the bytes.
If you have more questions about Endianness take a look at

http://en.wikipedia.org/wiki/Endianness

Greets olaf

--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]