| Endianness | |||||||||||||
| big-endian | |||||||||||||
| Storing data in memory | Address | Contents | |||||||||||
| 32-bit word: 4 bytes. | 1000 | 01 | |||||||||||
| Each byte has an individual address. | 1001 | 23 | |||||||||||
| Smallest addressable unit | 1002 | 45 | |||||||||||
| How many hexadecimal digits in each byte? | 1003 | 67 | |||||||||||
| Hex digit = 4 bits, so a byte can hold 2 digits. | 1004 | ||||||||||||
| How do we store the value 01234567hex? | 1005 | ||||||||||||
| One way: store the digits in order, | 1006 | ||||||||||||
| starting with the lowest address. | 1007 | ||||||||||||
| This is called big-endian, because the biggest-value | |||||||||||||
| byte is stored first. | |||||||||||||
| However, this means that the MOST-significant byte | |||||||||||||
| has the LOWEST address. | little-endian | ||||||||||||
| Another way: | Address | Contents | |||||||||||
| Store the LEAST-significant byte in the lowest | 1000 | 67 | |||||||||||
| address. | 1001 | 45 | |||||||||||
| This is called little-endian. | 1002 | 23 | |||||||||||
| 1003 | 01 | ||||||||||||
| 1004 | |||||||||||||
| 1005 | |||||||||||||
| 1006 | |||||||||||||
| 1007 | |||||||||||||