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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
06/04/04 15:45
Read: times


 
#71777 - RE: Little Endian Big endian conversion.
Responding to: ???'s previous message
I second Wolfgang's note that endianess is compiler dependent. In my case with my IAR compiler, it's also version dependent!

You will want to check the code generated by whatever conversion method you choose. I've found smaller faster code using the union conversion like Wolfgang's suggestion as compared to shifting/combining like Mahmood suggested (which was how I always used to do it).

The only way to know the endianess of a number is to know its source. For instance, I know that the data coming off my CAN bus is little endian, but my compiler uses big endian...so I know before I do any number crunching I've got to swap bytes around.

A while back Dan Henry posted a nice header file to handle endianess, see http://www.8052.com/forum/read.phtml?id=46147

Dennis



List of 23 messages in thread
TopicAuthorDate
Little Endian Big endian conversion.            01/01/70 00:00      
   RE: Little Endian Big endian conversion.            01/01/70 00:00      
      RE: Little Endian Big endian conversion.            01/01/70 00:00      
         RE: Little Endian Big endian conversion.            01/01/70 00:00      
            RE: Little Endian Big endian conversion.            01/01/70 00:00      
               RE: Little Endian Big endian conversion.            01/01/70 00:00      
                  RE: Little Endian Big endian conversion.            01/01/70 00:00      
                     RE: Little Endian Big endian conversion.            01/01/70 00:00      
               RE: Little Endian Big endian conversion.            01/01/70 00:00      
               Totally & Utterly Impossible!            01/01/70 00:00      
         RE: Little Endian or Big endian?            01/01/70 00:00      
      RE: Little Endian Big endian conversion.            01/01/70 00:00      
         RE: Junk            01/01/70 00:00      
   RE: Little Endian Big endian conversion.            01/01/70 00:00      
   RE: Little Endian Big endian conversion.            01/01/70 00:00      
      RE: machine-independent            01/01/70 00:00      
      RE: Little Endian Big endian conversion.            01/01/70 00:00      
         RE: Compiler-dependence            01/01/70 00:00      
            RE: Compiler-dependence            01/01/70 00:00      
   RE: Little Endian Big endian conversion.            01/01/70 00:00      
      RE: Little Endian Big endian conversion.            01/01/70 00:00      
   A Useful Link            01/01/70 00:00      
   RE: Little Endian Big endian conversion.            01/01/70 00:00      

Back to Subject List