]> git.lizzy.rs Git - rudp.git/blob - basetype.h
Switch to CMake
[rudp.git] / basetype.h
1 #ifndef __basetype_h__
2 #define __basetype_h__
3
4 #define IN
5 #define OUT
6 #define INOUT
7
8 #ifdef _WIN32
9
10 typedef char                    int8_t;
11 typedef unsigned char           uint8_t;
12 typedef short                   int16_t;
13 typedef unsigned short          uint16_t;
14 typedef int                     int32_t;
15 typedef unsigned int            uint32_t;
16
17 typedef __int64                 int64_t;
18 typedef unsigned __int64        uint64_t;
19
20 #define __BEGIN_ALIGNMENT(x)__ __pragma(pack(push, x))
21 #define __END_ALIGNMENT(x)__ __pragma(pack(pop))
22
23 #define __BEGIN_PACKED__ __pragma(pack(push, 1))
24 #define __END_PACKED__ __pragma(pack(pop))
25 #define __PACKED__
26
27 #define __STDCALL  __stdcall
28 #define INLINE  __inline
29 #define __LIKELY(x)     x
30 #define __UNLIKELY(x)   x
31
32
33 #elif defined(__linux__)
34
35 typedef unsigned char BYTE;
36 typedef unsigned short WORD;
37 typedef unsigned long DWORD;
38
39 typedef unsigned char UCHAR;
40 typedef unsigned short USHORT;
41 typedef unsigned int UINT;
42 typedef unsigned long ULONG;
43
44 #include <stdint.h>
45
46 typedef long LONG;
47
48 typedef const char * LPCSTR;
49 typedef char * LPSTR;
50
51 #define BOOL    int
52 #define TRUE    1
53 #define FALSE   0
54
55 #define __BEGIN_ALIGNMENT__(x)
56 #define __END_ALIGNMENT__(x) 
57
58 #define __BEGIN_PACKED__ 
59 #define __END_PACKED__ 
60 #define __PACKED__ __attribute__((__packed__))
61
62 #define __STDCALL
63 #define INLINE inline
64 #define __LIKELY(x) __builtin_expect(!!(x), 1)
65 #define __UNLIKELY(x) __builtin_expect(!!(x), 0)
66
67 #elif defined(ARM_UCOS_LWIP)
68
69 typedef char                    int8_t;
70 typedef unsigned char           uint8_t;
71 typedef short                   int16_t;
72 typedef unsigned short          uint16_t;
73 typedef int                     int32_t;
74 typedef unsigned int            uint32_t;
75
76 typedef __int64                 int64_t;
77 typedef unsigned __int64        uint64_t;
78
79 typedef unsigned char BYTE;
80 typedef unsigned short WORD;
81 typedef unsigned long DWORD;
82
83 typedef unsigned char UCHAR;
84 typedef unsigned short USHORT;
85 typedef unsigned int UINT;
86 typedef unsigned long ULONG;
87
88
89 #define __BEGIN_ALIGNMENT(x)__ 
90 #define __END_ALIGNMENT(x)__ 
91
92 #define __BEGIN_PACKED__ 
93 #define __END_PACKED__ 
94 #define __PACKED__ __attribute__((__packed__))
95
96 #define __STDCALL
97 #define INLINE  __inline
98 #define __LIKELY(x)     x
99 #define __UNLIKELY(x)   x
100
101 #define BOOL    int
102 #define TRUE    1
103 #define FALSE   0
104
105
106 #endif
107
108 #endif