Endian-ness

Bob Robillard yellowdog-general@lists.terrasoftsolutions.com
Thu Mar 11 20:30:02 2004


>From: Geert Janssens <geert.janssens3@pandora.be>
>
>this explanation confirms my own reasoning. I didn't know the Java VM 
>was big-endian though. Now I do !

Java is from Sun; every machine Sun ever built is big-endian.
(Well, except for their ill-fated x86 machines. :->)

Actually, every machine everyone ever built is big-endian, except
for Intel.  (That's a little exaggeration.)  The byte order used 
on the network in IP is big-endian, too.

Here's a couple of links with more about this than you want to know:

http://en.wikipedia.org/wiki/Big-endian
http://www.rdrop.com/~cary/html/endian_faq.html

Here's an excerpt from the first:

Big-endian numbers are easier to read when debugging 
<http://en.wikipedia.org/wiki/Debugging> a program but less intuitive 
(because the high byte is at the /smaller/ address); similarly 
little-endian numbers are more intuitive but harder to debug. The choice 
of big-endian vs. little-endian for a CPU design has begun a lot of 
flame wars <http://en.wikipedia.org/wiki/Flame_war>. Emphasizing the 
futility of this argument, the very terms /big-endian/ and 
/little-endian/ were taken from the Big-Endians and Little-Endians of 
Jonathan Swift <http://en.wikipedia.org/wiki/Jonathan_Swift>'s 
Gulliver's Travels <http://en.wikipedia.org/wiki/Gullivers_Travels>, two 
peoples in conflict over which end to crack an egg in the voyage to 
Lilliput and Blefuscu <http://en.wikipedia.org/wiki/Lilliput_and_Blefuscu>.

See the /Endian FAQ/ (external link, below), including the significant 
essay "/On holy wars and a plea for peace/" by Danny Cohen (1980).

    * Processor families that use big-endian storage: SPARC
      <http://en.wikipedia.org/wiki/SPARC>, Motorola 68000
      <http://en.wikipedia.org/wiki/Motorola_68000>, IBM 370
      <http://en.wikipedia.org/wiki/IBM_370>
    * Processor families that use little-endian format: x86
      <http://en.wikipedia.org/wiki/X86>, VAX
      <http://en.wikipedia.org/wiki/VAX>
    * Processor families that use either (determined by software): MIPS
      <http://en.wikipedia.org/wiki/MIPS_architecture>, DEC Alpha
      <http://en.wikipedia.org/wiki/DEC_Alpha>, PowerPC
      <http://en.wikipedia.org/wiki/PowerPC>
    * The PDP family of processors, which were word- rather than
      byte-addressable, used the unusual pattern of B-A-D-C (that is,
      byte-swap within words).

(Many CPUs have different solutions to the endian problem, such as 
64-bit SPARC and MIPS, which can change their operating endianness, or 
i386, which has a specialized BSWAP instruction for fast endian conversion)