??? 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. |