Programming

little endian과 big endian

jianna6 2014. 7. 11. 23:26




little endian 


Least significant byte(LSB)가 최소 주소에 저장됨
장점>산술연산이 빠르다.
Intel x86계열


big endian 


Least significant byte(LSB)가 최대 주소에 저장됨

장점>가독성이 뛰어나고, 대소비교가 빠르다.

Sun,모토로라계열

네트워크는 big Endian사용한다.!


example

변수 x는 다음과 같은 4bytes의 워드이다. 0x01234567

big endian

 

 0x100

 0x101

0x102 

 0x103

 

 

 

 01

23 

45 

67 

 

 

little endian

 

 0x100

 0x101

0x102 

 0x103

 

 

 

 67

45 

23 

01 

 

 


dump나 text에서 나타나는 순서와 메모리(stack)에서 나타나는 순서가 뒤바뀜.