Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
02/13/09 14:54
Read: times


 
#162362 - More to it than that!
Responding to: ???'s previous message
Oliver Sedlacek said:
It's just (sic) a matter of endian-ness.

No, there's more to it than that.

In particular, whether the compiler might add any padding and/or impose any alignment requiremnents...

(not an issue for 8-bitters, but should be considered in the context of "portability")

I use the pre-processor to sort out endian differences according to which compiler I'm using.

Yes, that will do it - and can also be used to add any directives needed to force the alignment and/or padding...

Note, however, that the language definition doesn't guarantee that unions will work this way - although I think pretty much all real implementations do...


List of 15 messages in thread
TopicAuthorDate
LSB byte of 24 bits            01/01/70 00:00      
   a union            01/01/70 00:00      
      union = fast, but not portable            01/01/70 00:00      
         Shift-and-Mask = Portable, and possibly not slow            01/01/70 00:00      
            Shifts and masks often resulting in optimum native code            01/01/70 00:00      
          can be portable            01/01/70 00:00      
         Can be portable            01/01/70 00:00      
            More to it than that!            01/01/70 00:00      
               which is why I do this very thing            01/01/70 00:00      
            for completeness there is the pointer            01/01/70 00:00      
   Split the word?            01/01/70 00:00      
   Tautology?            01/01/70 00:00      
      re: Tautology            01/01/70 00:00      
         possible, but not universal            01/01/70 00:00      
   thank you            01/01/70 00:00      

Back to Subject List