Last change
on this file since 7175 was 7175, checked in by Admin, 12 years ago |
Correct some linebreaks. Set svn property svn:eol-style LF on all files to make sure that checkins are using unix-linebreaks.
|
-
Property svn:eol-style
set to
LF
|
File size:
1.0 KB
|
Line | |
---|
1 | #ifndef _TYPES_H_
|
---|
2 | #define _TYPES_H_
|
---|
3 |
|
---|
4 | #ifndef uchar
|
---|
5 | typedef unsigned char uchar;
|
---|
6 | #endif
|
---|
7 |
|
---|
8 | #endif // _TYPES_H_
|
---|
9 |
|
---|
10 | #ifndef NO_ENDIAN_H
|
---|
11 | #if defined(__APPLE__)
|
---|
12 | #include <machine/endian.h>
|
---|
13 | #define __BYTE_ORDER __DARWIN_BYTE_ORDER
|
---|
14 | #define __BIG_ENDIAN __DARWIN_BIG_ENDIAN
|
---|
15 | #define __LITTLE_ENDIAN __DARWIN_LITTLE_ENDIAN
|
---|
16 | #elif defined(__FreeBSD__)
|
---|
17 | #include <sys/endian.h>
|
---|
18 | #define __BYTE_ORDER _BYTE_ORDER
|
---|
19 | #define __BIG_ENDIAN _BIG_ENDIAN
|
---|
20 | #define __LITTLE_ENDIAN _LITTLE_ENDIAN
|
---|
21 | #else
|
---|
22 | #include <endian.h>
|
---|
23 | #include <byteswap.h>
|
---|
24 | #endif
|
---|
25 | #endif
|
---|
26 |
|
---|
27 | #if defined(__linux__)
|
---|
28 |
|
---|
29 | #ifdef ntohl
|
---|
30 | #undef ntohl
|
---|
31 | #endif
|
---|
32 | #ifdef ntohs
|
---|
33 | #undef ntohs
|
---|
34 | #endif
|
---|
35 | #ifdef htonl
|
---|
36 | #undef htonl
|
---|
37 | #endif
|
---|
38 | #ifdef htons
|
---|
39 | #undef htons
|
---|
40 | #endif
|
---|
41 |
|
---|
42 | #if __BYTE_ORDER == __BIG_ENDIAN
|
---|
43 | # define ntohl(x) (x)
|
---|
44 | # define ntohs(x) (x)
|
---|
45 | # define htonl(x) (x)
|
---|
46 | # define htons(x) (x)
|
---|
47 | #else
|
---|
48 | # if __BYTE_ORDER == __LITTLE_ENDIAN
|
---|
49 | # define ntohl(x) __bswap_32 (x)
|
---|
50 | # define ntohs(x) __bswap_16 (x)
|
---|
51 | # define htonl(x) __bswap_32 (x)
|
---|
52 | # define htons(x) __bswap_16 (x)
|
---|
53 | # endif
|
---|
54 | #endif
|
---|
55 |
|
---|
56 | #endif
|
---|
Note:
See
TracBrowser
for help on using the repository browser.