[Tutor] little/big endian was Re: what is 'doubleword alignment'?

Albert-Jan Roskam fomcl at yahoo.com
Thu Jul 21 21:46:27 CEST 2011


Thanks a lot for your explanations, that was most helpful! I never realized my mother tongue (Dutch) is Little Endian, whereas English is Big Endian, e.g.:
dutch: negen-en-twintig (nine-and-twenty)
english: twenty-nine

I will improve my program based on what you all have said. I will let the program:
-find out the encoding of the input file
-find out the encoding of the terminal
-if necessary: find out if there are any other, compatible encodings on the terminal

Thanks again!

Cheers!!

Albert-Jan



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

All right, but apart from the sanitation, the medicine, education, wine, public order, irrigation, roads, a fresh water system, and public health, what have the Romans ever done for us?

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

--- On Thu, 7/21/11, Steven D'Aprano <steve at pearwood.info> wrote:

From: Steven D'Aprano <steve at pearwood.info>
Subject: Re: [Tutor] little/big endian was Re: what is 'doubleword alignment'?
To: tutor at python.org
Date: Thursday, July 21, 2011, 2:56 PM

Dave Angel wrote:

> Little-endian is the method used by the Intel processor (such as the Pentium).  Big-endian is the system used by most network protocols, as well as the 68000 and many other processors.

There used to be mainframes with various forms of middle-endian layouts. Fortunately they are no longer around.

http://www.retrologic.com/jargon/M/middle-endian.html


> For our purposes, it's the ordering of the bytes within a 16 or 32 bit number.  Little-endian puts the least significant byte first, while big-endian puts the most significant byte first.

In this context, least significant and most significant may need explaining.

In decimal numbers, we write one hundred and twenty-three as 123. The 1 is most significant, because it represents 1 HUNDRED rather than 1 UNIT. And similarly the 3 is least significant. So numbers using Arabic numerals are big-endian.

The same applies for computer integers. 123 written in hexadecimal is 7B, which of course is big-endian just like decimal. But when storing this number in memory, we have a choice: we can store it in big-endian format, just like we write it: 7B, where the 7 is the "left-most" (lowest address) number. Or we can store it in little-endian format, B7, where the 7 has the higher address, and read from right-to-left.

And of course, bytes themselves can be either little-endian or big-endian, *independently* of byte ordering within larger units.

http://en.wikipedia.org/wiki/Endianness
http://en.wikipedia.org/wiki/Bit_numbering



-- Steven
_______________________________________________
Tutor maillist  -  Tutor at python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20110721/81916932/attachment.html>


More information about the Tutor mailing list