[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [SLUG] Re: Endian-ness.
On Tue, Apr 04, 2000 at 12:43:55AM +1000, Michael Lake wrote:
> ora.com wrote:
> > Big Endian
> > A colorful way of describing the sequence in which multibyte numbers are stored in a computer's memory.
> >
> > Storing the most significant byte in the lowest memory address, which is the address of the data.
> ....
> > Most UNIXes (for example, all System V) and the Internet are Big Endian.
That's a really weird statement, unless they are referring to strict
use of XDR for on-disk data. System V certainly ran on many
little-endian machines: VAX, i386, We32(?). Sure, all the Internet
protocols are big endian, I just didn't want to edit the original
sentence. That's why internet code is full of htonl() and ntohl()
functions, which convert "host to network long" and vice versa.
This will be a nop for big-endian machines, and translate 0x01020304
into 0x04030201 for little-endian machines.
> > Motorola 680x0 microprocessors (and therefore Macintoshes), Hewlett-Packard
> > PA-RISC, and Sun SuperSPARC processors are Big Endian. The Silicon Graphics MIPS and IBM/Motorola PowerPC processors are both Little and Big Endian
> > (bi-endian).
But no-one has ever seen a little-endian PowerPC in the wild.
Interest for that died when Microsoft dropped the NT port to the
PowerPC.
Regarding the previous comment about sub-byte ordering: (Yes,
endianness hardly ever refers to this, since you hardly ever get
addressability below the byte level, and addressability is the
key.) Most serialisation systems ship the MSB of bytes in/out
first, but interestingly, many serialisation systems allow this to
be configured by the implementer. Have a look at all of the wacky
options available for connecting codecs to DSPs one day: you can
have LSB first or MSB first, or either framed in a variety of word
lengths, either left or right aligned, and then a whole different
section describing frame synchronisation. Yuck.
About the only time you'll ever encounter sub-byte endianness in
a computing situation is if you find yourself doing graphics coding
for a system that has one-bit-per-pixel image planes. Then it will
matter whether the MSB or the LSB appears in the top left-hand
corner of the screen. I believe that most (well, most are at
least byte-wide pixels these days) 1-bit displays are MSB-left
and big-endian, but Acorn has built a little-endian system all
the way down to the pixels.
--
Andrew
--
SLUG - Sydney Linux Users Group Mailing List - http://www.slug.org.au
To unsubscribe send email to slug-request@nospam.slug.org.au with
unsubscribe in the text