Re: [Freeciv-Dev] Endianess of packet data
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
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
| Chris Lawrence | The Linux/m68k FAQ |
| <quango@xxxxxxxxxxxxxxx> | http://www.linux-m68k.org/faq/faq.html |
| | |
| Amiga A4000 604e/233Mhz | Visit the Amiga Web Directory |
| with Linux/APUS 2.2.8 | http://www.cucug.org/amiga.html |