00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef _ASTERISK_ENDIAN_H
00024 #define _ASTERISK_ENDIAN_H
00025
00026
00027
00028
00029
00030 #include "asterisk/compat.h"
00031
00032 #ifndef __BYTE_ORDER
00033 #ifdef __linux__
00034 #include <endian.h>
00035 #elif defined(__OpenBSD__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__APPLE__)
00036 #include <machine/endian.h>
00037 #define __BYTE_ORDER BYTE_ORDER
00038 #define __LITTLE_ENDIAN LITTLE_ENDIAN
00039 #define __BIG_ENDIAN BIG_ENDIAN
00040 #else
00041 #ifdef __LITTLE_ENDIAN__
00042 #define __BYTE_ORDER __LITTLE_ENDIAN
00043 #endif
00044
00045 #if defined(i386) || defined(__i386__)
00046 #define __BYTE_ORDER __LITTLE_ENDIAN
00047 #endif
00048
00049 #if defined(sun) && defined(unix) && defined(sparc)
00050 #define __BYTE_ORDER __BIG_ENDIAN
00051 #endif
00052
00053 #endif
00054
00055 #endif
00056
00057 #ifndef __BYTE_ORDER
00058 #error Need to know endianess
00059 #endif
00060
00061 #endif
00062