[tremor] Endian header
Dimitry Andric
dim at xs4all.nl
Tue Sep 3 15:01:15 PDT 2002
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi,
I've just been trying to build Tremor on both a FreeBSD 4.6 and a
Win2k box. In both cases the build fails on a missing <endian.h>
header. It seems that this header is only available on Linux.
On FreeBSD, a similar header is found in <machine/endian.h>, but
almost never included directly. Instead, one includes <sys/types.h>,
which pulls in the file. AFAIK other BSD's behave the same.
When I checked a Linux box, it said exactly something like this in its
<sys/types.h> file (here from Debian 3.0 aka Woody):
/* In BSD <sys/types.h> is expected to define BYTE_ORDER. */
# include <endian.h>
So would you please consider using <sys/types.h> instead of
<endian.h>? This would at least fix the problem for *BSD, possibly
also for other Unix-like OSes.
For Win32, the solution seems to be simple, since most Windows boxes
run on x86, and are thus little endian. However, one must consider
that for example PocketPC devices, run on all kinds of different
architectures, which may have different endianness. Microsoft doesn't
seem to offer a standard header where this is defined.
An alternative to more #ifdef WIN32's might be to use something like:
#if (('1234' >> 24) == '1')
# define BYTE_ORDER LITTLE_ENDIAN
#elif (('4321' >> 24) == '1')
# define BYTE_ORDER BIG_ENDIAN
#else
# error What machine is this?
#endif
However, this might cause some older preprocessors to choke.
Cheers,
- --
Dimitry Andric <dim at xs4all.nl>
PGP Key: http://www.xs4all.nl/~dim/dim.asc
Fingerprint: 7AB462D2CE35FC6D42394FCDB05EA30A2E2096A3
Lbh ner abj va ivbyngvba bs gur QZPN
-----BEGIN PGP SIGNATURE-----
Version: 6.5.8ckt http://www.ipgpp.com/
Comment: http://duncan.gn.apc.org/stoa_cover.htm
iQA/AwUBPXUjILBeowouIJajEQI20QCgxxpoKHZgxJgG31Bvzyr8W9uKwdQAoMdM
XX3qSCPTkFSGlR1jQ+w8CsZU
=lPw0
-----END PGP SIGNATURE-----
--- >8 ----
List archives: http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'tremor-request at xiph.org'
containing only the word 'unsubscribe' in the body. No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.
More information about the Tremor
mailing list