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

Back to Subject List

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


 
Msg Score: 0
 +1 Good Answer/Helpful
 -1 Answer is Wrong
#71875 - RE: Little Endian Big endian conversion.
Responding to: ???'s previous message
Erik, it DOES matter. If you write your average good platform-independent code, it's all right.
But take this piece of code:

unsigned char high,low;
unsigned short word;

high=(unsigned char)(word / 256 );
low=(unsigned char)(word % 256 );

This will work on all platforms. But this one won't:

high=(unsigned char)(( word >> 8 ) & 0x00FF );
low=(unsigned char)( word & 0x00FF );

First one performs maths which are provided by system and just do the Right Thing. The second depends on byte order in a word.




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