NIM PC Cross Platform SDK
载入中...
搜索中...
未找到
nim_base_types.h
浏览该文件的文档.
1
8#ifndef NIM_SDK_UTIL_NIM_BASE_TYPES_H_
9#define NIM_SDK_UTIL_NIM_BASE_TYPES_H_
10
11#include <sys/types.h>
12
13#ifndef _MSC_VER
14// stdint.h is part of C99 but MSVC doesn't have it.
15#include <stdint.h> // For intptr_t.
16#endif
17
18/* define int types */
19#if defined(__GNUC__)
20
21#ifndef _STDINT_H
22
23/* FreeBSD has these C99 int types defined in /sys/inttypes.h already */
24#ifndef _SYS_TYPES_H
25typedef signed char int8_t;
26typedef signed short int16_t;
27typedef signed int int32_t;
28typedef signed long long int64_t;
29typedef unsigned char uint8_t;
30typedef unsigned short uint16_t;
31typedef unsigned int uint32_t;
32typedef unsigned long long uint64_t;
33#else
34typedef u_int8_t uint8_t;
35typedef u_int16_t uint16_t;
36typedef u_int32_t uint32_t;
37typedef u_int64_t uint64_t;
38#endif // _SYS_TYPES_H
39
40#endif // _STDINT_H
41
42#elif defined(_MSC_VER) && (_MSC_VER != 1900) // not vs2015
43typedef signed char int8_t;
44typedef signed short int16_t;
45typedef signed int int32_t;
46typedef signed __int64 int64_t;
47typedef unsigned char uint8_t;
48typedef unsigned short uint16_t;
49typedef unsigned int uint32_t;
50typedef unsigned __int64 uint64_t;
51
52// below vs2015 only
53#if _MSC_VER < 1900
54
55/* the following definitions are from VS2010's stdint.h */
56#ifndef _INTPTR_T_DEFINED
57#define _INTPTR_T_DEFINED
58#ifdef _WIN64
59typedef __int64 intptr_t;
60#else /* _WIN64 */
61typedef _W64 int intptr_t;
62#endif /* _WIN64 */
63#endif /* _INTPTR_T_DEFINED */
64
65#ifndef _UINTPTR_T_DEFINED
66#define _UINTPTR_T_DEFINED
67#ifdef _WIN64
68typedef unsigned __int64 uintptr_t;
69#else /* _WIN64 */
70typedef _W64 unsigned int uintptr_t;
71#endif /* _WIN64 */
72#endif /* _UINTPTR_T_DEFINED */
73
74#endif //_MSC_VER < 1900
75
76#endif // COMPILER_GCC/COMPILER_MSVC
77
78// const uint8_t kUint8Max = (( uint8_t) 0xFF);
79// const uint16_t kUint16Max = ((uint16_t) 0xFFFF);
80// const uint32_t kUint32Max = ((uint32_t) 0xFFFFFFFF);
81// const uint64_t kUint64Max = ((uint64_t) GG_LONGLONG(0xFFFFFFFFFFFFFFFF));
82// const int8_t kInt8Min = (( int8_t) 0x80);
83// const int8_t kInt8Max = (( int8_t) 0x7F);
84// const int16_t kInt16Min = (( int16_t) 0x8000);
85// const int16_t kInt16Max = (( int16_t) 0x7FFF);
86// const int32_t kInt32Min = (( int32_t) 0x80000000);
87// const int32_t kInt32Max = (( int32_t) 0x7FFFFFFF);
88// const int64_t kInt64Min = (( int64_t) GG_LONGLONG(0x8000000000000000));
89// const int64_t kInt64Max = (( int64_t) GG_LONGLONG(0x7FFFFFFFFFFFFFFF));
90
91#endif // NIM_SDK_UTIL_NIM_BASE_TYPES_H_