Robert Adsett wrote: > At 06:18 PM 4/29/06 +0200, Jan Thogersen wrote: > >It makes a lot of sense what you are saying. What I was trying to do was > >moving bytes from a SD card into the structure. > >The structure was made to follow the format of which the bytes was > >aligned on the SD card. I thought that this was a very beautiful way of > >doing it. I have seen code grabbing the struct byte by byte. However, > >when I ran this code on a HCS12 CPU then I could just make a memcpy into > >the struct and that was it. It was way more code size effective and much > >nicer to look at. > > > >But I get your point about the portability! So there is two ways I can > >solve this problem... Right? Either give the compiler a pragma to pack > >the struct and live with the portability problems or rewrite my code to > >grab the protocol byte by byte. > > That's about the size of it. You take a performance hit either way. > With > the pragma you get lower performance and larger code when you access the > structure elements later in the code. When you use cracking routines to > load and unload the structure in place of a memcpy you get the obvious > time/size hit at the interface. Ok. Tanks everyone! I went for the quick fix... The pragma packed worked just fine! Have a nice day. Best regards Jan
Message
Re: [lpc2000] Re: LPC2148 and words on odd addresses.
2006-04-29 by Jan Thogersen
Attachments
- No local attachments were found for this message.