Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
407 views
in Technique[技术] by (71.8m points)

endianness - Little Endian vs Big Endian?

I'm having troubles wrapping my head on the two. I understand how to represent something in big endian.

For example -12 is 1111 1111 1111 0100

But why is the little endian representation 1111 0100 1111 1111 instead of 0100 1111 1111 1111?

Question&Answers:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Endianness is about byte address order. Little endian means the lower significant bytes get the lower addresses. Big endian means the other way around. So it's about the bytes (8-bit chunks) not nibbles (4-bit chunks). Most computers we use (there are a few exceptions) address bytes at the individual address level.

Taking the -12 example:

Little endian, in memory, would be:

000000: F4
000001: FF

Big endian, in memory, would be:

000000: FF
000001: F4

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...