Re: architectures, endianness
On Tue, Sep 28, 1999 at 09:32:56PM -0500, Chris Lawrence wrote:
> On Sep 29, David Coe wrote:
> > Do we have a table/chart somewhere that explains which
> > Architectures use which endianness? Gpart has incomplete
> > support for endianness, the beginnings of which are
> > implemented as shown below; it behaves as if only i386
> > and alpha are little-endian --is that true?
>
> At least on Linux, use /usr/include/endian.h to determine the
> machine's __BYTE_ORDER (which will be __LITTLE_ENDIAN, __BIG_ENDIAN or
> __PDP_ENDIAN). Thus there's no need for architecture testing...
This is not Linux specific, but a feature of GLIBC.
However, you usually don't include endian.h directly, but <sys/param.h>.
Which is exactly what the AC_C_BIGENDIAN autoconf dcheck oes :)
But the autoconf check is better, because it also can run a small test
program if __BYTE_ORDER is not defined, so you get it right even on machines
which don't define this macro in their header files.
Thanks,
Marcus
--
`Rhubarb is no Egyptian god.' Debian http://www.debian.org Check Key server
Marcus Brinkmann GNU http://www.gnu.org for public PGP Key
Marcus.Brinkmann@ruhr-uni-bochum.de PGP Key ID 36E7CD09
http://homepage.ruhr-uni-bochum.de/Marcus.Brinkmann/
Reply to: