2012年3月14日 星期三

LITTLE_ENDIAN and BIG_ENDIAN

The keywords LITTLE_ENDIAN and BIG_ENDIAN could specify store order in memory.


If there is a two byte data in memory, Ex: long d=0x12345678
It would be store as the order as below table.
big-endian     little-endian
0x0000    
0x12     
0x78
0x0001
0x34
0x56
0x0002
0x56
0x34
0x0003
0x78
0x12


What different ?


for some CPU:
  • INTEL X86、DEC VAX use LITTLE-ENDIAN
  • HP、IBM、MOTOROLA 68K use BIG-ENDIAN
  • POWERPC support both,called BI-ENDIAN


沒有留言:

張貼留言