I\'m trying to figure out big endian and little endian byte order. I uderstand t
ID: 3542609 • Letter: I
Question
I'm trying to figure out big endian and little endian byte order. I uderstand that with little endian, the least significant byte is stored first followed by the most significant, and with big endian this is reversed. So this would look like:
Little Endian - 12 34 56 78
Big Endian - 78 56 34 12
That makes sense. My problem is, my textbook only gave me an example where the address was sequential, as seen above (12345678). Because of that I don't know how to store anything non-sequential, or including letters. For instance, with a randomized address like 25382716, would it be stored with just the ends taken into account, or would all sets of bytes be rearanged?
Little Endian - 16 27 38 25
Big Endian - 25 38 27 16
or
Little Endian - 16 25 27 38
Big Endian - 38 27 25 16
Thanks!
Explanation / Answer
Little and big endian are two ways of storing
multibyte data-types ( int, float, etc).
In little endian machines,
last byte of binary representation of
the multibyte data-type is stored first.
On the other hand, in big endian machines,
first byte of binary representation of the multibyte
data-type is stored first.
hence
for 25382716
last byte = 16(as one digit = 4 bit)
second last byte = 27
and so on..
so little endian notation == 16 27 38 25
and big endian notation ==25 38 27 16