/*
- * $Id: endian.h,v 1.5 2001-09-07 13:44:38 rufustfirefly Exp $
+ * $Id: endian.h,v 1.9 2009-01-06 20:05:00 morgana Exp $
*
* Copyright (c) 1990,1991 Regents of The University of Michigan.
* All Rights Reserved. See COPYRIGHT.
#ifdef _ISOC9X_SOURCE
#include <inttypes.h>
+#ifndef __BIT_TYPES_DEFINED__
+#define __BIT_TYPES_DEFINED__
typedef uint8_t u_int8_t;
typedef uint16_t u_int16_t;
typedef uint32_t u_int32_t;
typedef uint64_t u_int64_t;
+#endif /* ! __BIT_TYPES_DEFINED__ */
#else
/* handle sunos and solaris */
* various types are forever. this makes some assumptions about integer
* sizes. */
#if defined (ultrix) || defined(HAVE_32BIT_LONGS) || defined(HAVE_64BIT_LONGS)
+#ifndef __BIT_TYPES_DEFINED__
+#define __BIT_TYPES_DEFINED__
typedef unsigned char u_int8_t;
typedef unsigned short u_int16_t;
typedef unsigned int u_int32_t;
typedef int int32_t;
+#endif
#endif /* ultrix || HAVE_32BIT_LONGS || HAVE_64BIT_LONGS */
#ifdef ultrix
#define PDP_ENDIAN 3412
-#ifdef WORDS_BIGENDIAN
+#if defined(WORDS_BIGENDIAN) || defined(_BIG_ENDIAN)
#define BYTE_ORDER BIG_ENDIAN
#else
#define BYTE_ORDER LITTLE_ENDIAN
#else /* mips && KERNEL */
-#if !( defined( sun ) && defined( i386 ))
+#if !( defined( sun ) && ( defined( i386 ) || defined(__x86_64) ) )
unsigned short ntohs(), htons();
unsigned int ntohl(), htonl();
#endif /* ! ( sun && i386 ) */
#endif /* mips && KERNEL */
-#endif /* BYTE_ORDER */
+#endif /* BYTE_ORDER == BIGENDIAN*/
# endif /* sun ultrix _IBMR2 */
# endif /* ntohl */
+#endif /* BYTE_ORDER */
#endif /* _ATALK_ENDIAN_H_ */
+