Wednesday, June 10, 2009

Big endian vs Little endian


8 bits is a byte.
4 bytes is a word.




Above figure shows a 32 bit processor register.

Byte order: Byte3 Byte2 Byte1 Byte0

Little Endian: lower order byte of a number is stored in memory at lower address, and the higher order byte is stored at higher address.

Big Endian: lower order byte of a number is stored in memory at higer address, and the higher order byte is stored at lower address.

Example:

1001 / 2 = 1
500 / 2 = 0
250 / 2 = 0
125 / 2 = 1
62 / 2 = 0
31 / 2 = 1
15 / 2 = 1
7 / 2 = 1
3 / 2 = 1
1 / 2 = 1

= 1111101001(binary)


No comments: