I've read descriptions online describing big and little endian. However, they all seem to basically read the same way and I am still confused on the the actual implementation regarding "most" and "least" significant bytes. I understand that little endian values evaluate the "least significant" values first and under big endian the "most significant" bytes are evaluated first. However, I'm unclear as to the meaning of "most" and "least" significant. I think it would help me to understand if I use an actual example which I will put forth here:
I have an integer value: 12345
If I convert it to a hex value using the Windows calculator, I get a value of: 3039 (basically a two byte value). Is the value 3039 showing the bytes representing the integer value 12345 stored as a little or big endian value and how do I determine this based on the value?
Endianness is a term that describes the order in which a sequence of bytes is stored in computer memory. Endianness can be either big or small, with the adjectives referring to which value is stored first.
Big Endian Byte Order: The most significant byte (the "big end") of the data is placed at the byte with the lowest address. The rest of the data is placed in order in the next three bytes in memory.
By far the most common ordering of multiple bytes in one number is the little-endian, which is used on all Intel processors.
Little-endian (LSB) means we start with the least significant part in the lowest address. Big-endian (MSB) means we start with the most significant part. For example, 16-bit integer 0x1234 would be stored in bytes as 0x12 0x34 (LSB) or 0x34 0x12 (MSB).
Endian-ness refers to how numbers are stored in memory. It has nothing to do with evaluation order of bytes. If memory addresses increase left to right across this page, then on a big-endian machine your number would be stored
30 39
and on a little-endian machine
39 30
Your calculator is always going to display numbers as we read them, which is the big-endian way, even though numbers are stored in little-endian fashion on the Intel hardware you're probably using.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With