2
* Copyright (C) 1998, 1999 D. Hugh Redelmeier.
4
* This program is free software; you can redistribute it and/or modify it
5
* under the terms of the GNU General Public License as published by the
6
* Free Software Foundation; either version 2 of the License, or (at your
7
* option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
9
* This program is distributed in the hope that it will be useful, but
10
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
11
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14
* RCSID $Id: endian.h,v 1.6 2002/04/24 07:35:49 mcr Exp $
17
/* sets BYTE_ORDER, LITTLE_ENDIAN, and BIG_ENDIAN */
19
#if defined(__OpenBSD__) || defined(__NetBSD__)
20
# include <machine/endian.h>
22
# if defined(i386) && !defined(__i386__)
24
# define MYHACKFORTHIS 1
27
# if 0 /* kernel's <asm/byteorder.h> clashes with glibc's <netinet/in.h> */
28
/* The problem (in RedHat 5.0) is the typing of the "longs" (32-bit values)
29
* in the [nh]to[hn]l functions:
30
* - <asm/byteorder.h> uses unsigned long
31
* - <netinet/in.h> uses u_int32_t which is unsigned int
32
* Since 64-bit machines are supported, <asm/byteorder.h> should be changed.
33
* For now, we simply don't use <asm/byteorder.h>.
35
# include <asm/byteorder.h>
41
#elif !(defined(BIG_ENDIAN) && defined(LITTLE_ENDIAN) && defined(BYTE_ORDER))
42
/* we don't know how to do this, so we require the macros to be defined
43
* with compiler flags:
44
* -DBIG_ENDIAN=4321 -DLITTLE_ENDIAN=1234 -DBYTE_ORDER=BIG_ENDIAN
45
* or -DBIG_ENDIAN=4321 -DLITTLE_ENDIAN=1234 -DBYTE_ORDER=LITTLE_ENDIAN
46
* Thse match the GNU definitions
48
# include <sys/endian.h>
52
#error BIG_ENDIAN must be defined
56
#error LITTLE_ENDIAN must be defined
60
#error BYTE_ORDER must be defined