/*
- * $Id: endian.h,v 1.4 2001-06-29 14:14:47 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 BIG_ENDIAN 4321
#define PDP_ENDIAN 3412
-#ifdef sun
-#if defined(i386) || defined(_LITTLE_ENDIAN)
-#define BYTE_ORDER LITTLE_ENDIAN
-#else /* i386 || _LITTLE_ENDIAN */
-#define BYTE_ORDER BIG_ENDIAN
-#endif /* i386 || _LITTLE_ENDIAN */
-#else /* sun */
-#if defined(MIPSEB) || defined(__hppa)
+
+#if defined(WORDS_BIGENDIAN) || defined(_BIG_ENDIAN)
#define BYTE_ORDER BIG_ENDIAN
-#else /* MIPSEB || __hppa */
-#ifdef MIPSEL
+#else
#define BYTE_ORDER LITTLE_ENDIAN
-#else /* MIPSEL */
-#error Like, what is your byte order, man?
-#endif /* MIPSEL*/
-#endif /* MIPSEB || __hppa */
-#endif /* sun */
-# endif /* BYTE_ORDER */
+#endif /* WORDS_BIGENDIAN */
# ifndef ntohl
# if defined( sun ) || defined( ultrix ) || defined( _IBMR2 )
#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_ */
+