Big-Endians Little-Endians and Bi-Endians Unfortunately there is not a universal standard for how the bytes in a word are stored in computer memory or how the bits are ordered in each byte. Byte Ordering - Suppose we are to store the 32-bit hexadecimal word AB1032FE into a byte addressable memory. Address Value Address Value 184 AB 185 10 186 32 187 FE 184 FE 185 32 186 10 187 AB This mapping is called big-endian since it stores the word with its most significant byte in the lowest address This mapping is called little-endian since it stores the word with its least significant byte in the lowest address
Big-Endian Address Map Byte Addr Little-Endian Address Map For byte-addressing the order is immaterial. An issue arises when we want to reference a multibyte word with a single address. The Intel 80x86, Pentium II, VAX and Alpha are little-endian machines. Other such as the IBM 370/390, the Motorola 680x0, and Sun SPARC are big-endian systems. The PowerPC allows both modes and is said to be bi-endian. struct{ int a; //0x1112_1314 int pad; // double b; //0x2122_2324_2526_2728 char* c; //0x3132_3334 char d[7]; //'A','B','C','D','E','F','G' short e; //0x5152 int f; //0x6161_6364 } s; 11 12 13 14 21 22 23 24 25 26 27 28 31 32 33 34 A B C D E F G 51 52 61 62 63 64 00 08 10 18 20 Byte Addr Big-Endian Address Map 00 08 10 18 20 14 13 12 11 28 27 26 25 24 23 22 21 34 33 32 31 A B C D E F G 52 51 64 63 62 61 Byte Addr Little-Endian Address Map