personal 30 Aug 2007 09:42 pm
Introduction to Endianness - big endian, little endian, byte order, byte swap
Introduction to Endianness - big endian, little endian, byte order, byte swap
Endianness is the attribute of a system that indicates whether integers are represented from left to right or right to left. Why, in todays world of virtual machines and gigahertz processors, would a programmer care about such a silly topic? Well, unfortunately, endianness must be chosen every time a hardware or software architecture is designed, and there isnt much in the way of natural law to help decide. So implementations vary.
Endianness comes in two varieties: big and little. A big-endian representation has a multibyte integer written with its most significant byte on the left; a number represented thus is easily read by English-speaking humans. A little-endian representation, on the other hand, places the most significant byte on the right. Of course, computer architectures dont have an intrinsic “left” or “right” about them. These human terms are borrowed from our written forms of human communication. The following definitions are more precise:
Big endian means that the most significant byte of any multibyte data field is stored at the lowest memory address, which is also the address of the larger field.
Little endian means that the least significant byte of any multibyte data field is stored at the lowest memory address, which is also the address of the larger field.
Leave a Reply
You must be logged in to post a comment.