Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Endianness, "Most Significant", and "Least Significant"

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?

like image 284
GregH Avatar asked Jan 12 '12 06:01

GregH


People also ask

What is the significance of endianness?

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.

Where is the most significant bit in big-endian?

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.

What is the most common endianness?

By far the most common ordering of multiple bytes in one number is the little-endian, which is used on all Intel processors.

What is the MSB in little-endian?

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).


1 Answers

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.

like image 136
Kyle Jones Avatar answered Oct 12 '22 04:10

Kyle Jones