Subject: Re: Inquiring minds want to know.
To: None <port-alpha@netbsd.org>
From: der Mouse <mouse@Rodents.Montreal.QC.CA>
List: port-alpha
Date: 05/17/2003 13:19:04
> And while I (kind of) know the difference between Little Endian and
> big Endian, I've never really learned what the real difference is and
> it might be advantageous to have one or the other..

The difference applies only when the machine supports entities larger
than the "addressing grain", the smallest addressible unit of memory.

Since most machines today address memory in units of octets (usually
spoken of as bytes), this means the difference applies to multi-byte
quantities.  The rest of this uses "byte" as shorthand for "addressible
unit of memory", and for the sake of brevity I will assume the object
is an integer.

A big-endian machine stores the most-significant byte at the
lowest-addressed location contained in the integer, with significance
decreasing with increasing addresses until the least-significant byte
is found at the highest-addressed location.

A little-endian machine reverses this, storing the least-significant
byte at the lowest-addressed location, with significance increasing
with increasing addresses, storing the most-significant byte at the
highest-addressed location.

For values longer than two bytes, other orders are possible, but with
two exceptions (PDP-11 32-bit values and VAX floating point) I know
of no cases where any of them were actually used.

There is comparatively little advantage to either over the other.
Occasionally situations will arise where one happens to be more
convenient than the other, but they are comparatively rare and at least
roughly balanced which endianness they favor.  I suspect it's largely a
question of which endianness the machine's designer preferred.

/~\ The ASCII				der Mouse
\ / Ribbon Campaign
 X  Against HTML	       mouse@rodents.montreal.qc.ca
/ \ Email!	     7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B