diff options
author | (no author) <(no author)@f38db490-d61c-443f-a65b-d21fe96a405b> | 2005-06-24 22:12:25 +0000 |
---|---|---|
committer | (no author) <(no author)@f38db490-d61c-443f-a65b-d21fe96a405b> | 2005-06-24 22:12:25 +0000 |
commit | b507b4a2fcacc58c85eb8356f3c2256ed9bd9ac2 (patch) | |
tree | a2c3b9a8896e7b342006f651d8c183a46d834e94 /include/asterisk/endian.h | |
parent | 21b8fbf2f504823394503b67b5343ba26bbeb882 (diff) |
This commit was manufactured by cvs2svn to create branch 'v1-0'.
git-svn-id: http://svn.digium.com/svn/asterisk/branches/v1-0@6004 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'include/asterisk/endian.h')
-rwxr-xr-x | include/asterisk/endian.h | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/include/asterisk/endian.h b/include/asterisk/endian.h new file mode 100755 index 000000000..f5e20fb07 --- /dev/null +++ b/include/asterisk/endian.h @@ -0,0 +1,60 @@ +/* + * Asterisk -- A telephony toolkit for Linux. + * + * Asterisk architecture endianess compatibility definitions + * + * Copyright (C) 1999 - 2005, Digium, Inc. + * + * Mark Spencer <markster@digium.com> + * + * This program is free software, distributed under the terms of + * the GNU Lesser General Public License. Other components of + * Asterisk are distributed under The GNU General Public License + * only. + */ + +#ifndef _ASTERISK_ENDIAN_H +#define _ASTERISK_ENDIAN_H + +/* + * Autodetect system endianess + */ + +#ifdef SOLARIS +#include "solaris-compat/compat.h" +#endif + +#ifndef __BYTE_ORDER +#ifdef __linux__ +#include <endian.h> +#elif defined(__OpenBSD__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__APPLE__) +#if defined(__OpenBSD__) +#include <machine/types.h> +#endif /* __OpenBSD__ */ +#include <machine/endian.h> +#define __BYTE_ORDER BYTE_ORDER +#define __LITTLE_ENDIAN LITTLE_ENDIAN +#define __BIG_ENDIAN BIG_ENDIAN +#else +#ifdef __LITTLE_ENDIAN__ +#define __BYTE_ORDER __LITTLE_ENDIAN +#endif /* __LITTLE_ENDIAN */ + +#if defined(i386) || defined(__i386__) +#define __BYTE_ORDER __LITTLE_ENDIAN +#endif /* defined i386 */ + +#if defined(sun) && defined(unix) && defined(sparc) +#define __BYTE_ORDER __BIG_ENDIAN +#endif /* sun unix sparc */ + +#endif /* linux */ + +#endif /* __BYTE_ORDER */ + +#ifndef __BYTE_ORDER +#error Need to know endianess +#endif /* __BYTE_ORDER */ + +#endif /* _ASTERISK_ENDIAN_H */ + |