Complete.Org: Mailing Lists: Archives: freeciv-dev: July 1999:
Re: [Freeciv-Dev] Endianess of packet data

Re: [Freeciv-Dev] Endianess of packet data

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: Freeciv List <freeciv-dev@xxxxxxxxxxx>
Subject: Re: [Freeciv-Dev] Endianess of packet data
From: Chris Lawrence <quango@xxxxxxxxxxxxxxx>
Date: Thu, 15 Jul 1999 22:58:00 -0500

On Jul 16, David Pfitzner wrote:
> Which is why freeciv packets, to be machine independent, use a 
> standard order ("network byte order") instead of the native 
> endianness of the machine being used.

TCP/IP's network byte order is big-endian.  However, it is always a
good policy to never assume the endianness of the machine you will be
running on.  Places where such assumptions were made (the Linux
ext2fs, for one) can get really nasty.  Use the macros and functions.
They are your friend.  And any decent compiler will optimize them out
on a BE platform.

Most PowerPC implementations are big-endian (I know Mac OS and Linux
are).  I suspect this is because most PowerPC people worked on other
Motorola chips.  [I think MIPS also has big and little endian
implementations; I assume any modern LE architecture would have a fast
LE-BE conversion because of the speed implications when dealing with
TCP/IP data.

|        Chris Lawrence        |             The Linux/m68k FAQ             |
|   <quango@xxxxxxxxxxxxxxx>   |   |
|                              |                                            |
|    Amiga A4000 604e/233Mhz   |        Visit the Amiga Web Directory       |
|     with Linux/APUS 2.2.8    |      |

[Prev in Thread] Current Thread [Next in Thread]