source: trunk/oscam-types.h@ 2103

Last change on this file since 2103 was 2103, checked in by merek, 14 years ago

Merge from UMP r2028: fix a problem with big endian / little endian definition for osx, this was breaking sky decoding (which probably never worked if you were running oscam os OS X)

File size: 1.1 KB
Line 
1#ifndef _TYPES_H_
2#define _TYPES_H_
3
4#if !defined(OS_AIX)
5typedef unsigned char uchar;
6#endif
7
8
9
10#if defined(OS_CYGWIN32) || defined(OS_HPUX) || defined(OS_FREEBSD) || defined(OS_MACOSX)
11typedef unsigned long ulong;
12typedef unsigned short ushort;
13#endif
14
15typedef unsigned long long ullong;
16
17#endif // _TYPES_H_
18
19#ifndef NO_ENDIAN_H
20 #ifdef OS_MACOSX
21 #include <machine/endian.h>
22 #define __BYTE_ORDER __DARWIN_BYTE_ORDER
23 #define __BIG_ENDIAN __DARWIN_BIG_ENDIAN
24 #define __LITTLE_ENDIAN __DARWIN_LITTLE_ENDIAN
25 #else
26 #include <endian.h>
27 #include <byteswap.h>
28 #endif
29#endif
30
31#if defined(CS_EMBEDDED) || defined(OS_LINUX)
32
33#ifdef ntohl
34#undef ntohl
35#endif
36#ifdef ntohs
37#undef ntohs
38#endif
39#ifdef htonl
40#undef htonl
41#endif
42#ifdef htons
43#undef htons
44#endif
45
46#if __BYTE_ORDER == __BIG_ENDIAN
47# define ntohl(x) (x)
48# define ntohs(x) (x)
49# define htonl(x) (x)
50# define htons(x) (x)
51#else
52# if __BYTE_ORDER == __LITTLE_ENDIAN
53# define ntohl(x) __bswap_32 (x)
54# define ntohs(x) __bswap_16 (x)
55# define htonl(x) __bswap_32 (x)
56# define htons(x) __bswap_16 (x)
57# endif
58#endif
59
60#endif // CS_EMBEDDED || OS_LINUX
Note: See TracBrowser for help on using the repository browser.