blob: cef9d7ba9d276b1438e67f691ddadca82b1f83be (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
/*
* 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 */
|