🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.arch
Article #12495

A better theory for Endian origins

#12495
From: Douglas W. Jones,201H MLH,319335...
Date: Fri, 08 Jan 1993 18:54
59 lines
2851 bytes
The decision whether to go big-endian or little-endian on byte numbering
has natural ties to the bit numbering in a word, and this is, I think,
one of the historical forces behind the war of the endians.

   There are a few rational ways of numbering the bits in a word.  One is
to number them left to right:

  1 2 3 4 ...

This has no particular appeal other than the fact that it is the first
to come to mind when you start numbering parts of a word.


   Another is to think of the formula for the value of a binary number:

  V = Sum( b[i]*2**i )

To make this work for integers, you've got to number the bits as:

  ... 3 2 1 0


   Remember, though, that the first computer designers tended to think in
terms of fixed point fractions, not integers.  This thinking pervades
the early papers on computer arithmetic from the 1940's.  In this case,
your machine word has a binary point just to the right of the sign bit,
and the formula for the value (in 2's complement form) is:

  V = -b[0] + Sum( b[i]*2**(-i) )

To make this work, you number your bits like this:

  0 1 2 3 ...


Summary:  There is a good argument for little-endian bit numbering when
you are thinking mostly in terms of integers, and there is a good argument
for big-endian bit numbering when you are thinking mostly in terms of
fixed point fractions.


   Back to the war of the endians, once you've decided how to number the
bits in your word, it's awfully tempting to number the bytes in a word
in the same way, particularly if you provide any instructions that address
bits in a word directly.  It's true that it's all arbitrary, in some global
sense, but documentation sure seems to make more sense when you number
things in the same order for both bits and bytes.

   The least rational of all endian systems are the mixed endian messes
where bytes are packed in orders such as 2301.  These seem to result from
multiple generations of design, for example, where bytes in a sixteen bit
word are little endian, but software for 32 bit operands grew up doing
wordwise 16 bit work in a big endian style.  Then, when it came time to
do 32 bit stuff in hardware, the data formats that were established by
brain dead programmers become enshrined in hardware standards that will
probably be with us for decades.

					Doug Jones
					jones@cs.uiowa.edu
Technical Details
Message-ID: <1993Jan8.185448.2405@news.uiowa.edu>
Path: arc1-ca.pugleaf.net!sparky!uunet!news.uiowa.edu!news
References: <1ikepuINNgt7@spim.mti.sgi.com>

Show Full Headers
Complete Article Headers
Newsgroups: comp.arch
Path: arc1-ca.pugleaf.net!sparky!uunet!news.uiowa.edu!news
From: jones@pyrite.cs.uiowa.edu (Douglas W. Jones,201H MLH,3193350740,3193382879)
Subject: A better theory for Endian origins
Sender: news@news.uiowa.edu (News)
Message-ID: <1993Jan8.185448.2405@news.uiowa.edu>
Date: Fri, 8 Jan 1993 18:54:48 GMT
References: <1ikepuINNgt7@spim.mti.sgi.com>
Nntp-Posting-Host: pyrite.cs.uiowa.edu
Organization: University of Iowa, Iowa City, IA, USA
Lines: 59