00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014 #ifndef OR_TOOLS_BASE_INTEGRAL_TYPES_H_
00015 #define OR_TOOLS_BASE_INTEGRAL_TYPES_H_
00016
00017 #ifndef SWIG
00018
00019 typedef signed char schar;
00020 typedef signed char int8;
00021 typedef short int16;
00022 typedef int int32;
00023 #ifdef COMPILER_MSVC
00024 typedef __int64 int64;
00025 #else
00026 typedef long long int64;
00027 #endif
00028
00029
00030
00031
00032
00033
00034
00035 typedef unsigned char uint8;
00036 typedef unsigned short uint16;
00037 typedef unsigned int uint32;
00038 #ifdef COMPILER_MSVC
00039 typedef unsigned __int64 uint64;
00040 #else
00041 typedef unsigned long long uint64;
00042 #endif
00043
00044
00045
00046
00047
00048 typedef signed int char32;
00049
00050
00051
00052
00053
00054
00055
00056
00057 typedef unsigned long uword_t;
00058
00059
00060
00061 typedef long sword_t;
00062
00063 #endif
00064
00065
00066
00067 #undef GG_LONGLONG
00068 #undef GG_ULONGLONG
00069 #undef GG_LL_FORMAT
00070
00071 #ifdef COMPILER_MSVC
00072
00073
00074 #define GG_LONGLONG(x) x##I64
00075 #define GG_ULONGLONG(x) x##UI64
00076
00077
00078 #define GG_LL_FORMAT "I64" // As in printf("%I64d", ...)
00079 #define GG_LL_FORMAT_W L"I64"
00080
00081 #else
00082
00083 #define GG_LONGLONG(x) x##LL
00084 #define GG_ULONGLONG(x) x##ULL
00085 #define GG_LL_FORMAT "ll" // As in "%lld". Note that "q" is poor form also.
00086 #define GG_LL_FORMAT_W L"ll"
00087
00088 #endif // COMPILER_MSVC
00089
00090
00091 static const uint8 kuint8max = static_cast<uint8>(0xFF);
00092 static const uint16 kuint16max = static_cast<uint16>(0xFFFF);
00093 static const uint32 kuint32max = static_cast<uint32>(0xFFFFFFFF);
00094 static const uint64 kuint64max =
00095 static_cast<uint64>(GG_LONGLONG(0xFFFFFFFFFFFFFFFF));
00096 static const int8 kint8min = static_cast<int8>(0x80);
00097 static const int8 kint8max = static_cast<int8>(0x7F);
00098 static const int16 kint16min = static_cast<int16>(0x8000);
00099 static const int16 kint16max = static_cast<int16>(0x7FFF);
00100 static const int32 kint32min = static_cast<int32>(0x80000000);
00101 static const int32 kint32max = static_cast<int32>(0x7FFFFFFF);
00102 static const int64 kint64min =
00103 static_cast<int64>(GG_LONGLONG(0x8000000000000000));
00104 static const int64 kint64max =
00105 static_cast<int64>(GG_LONGLONG(0x7FFFFFFFFFFFFFFF));
00106
00107 #endif // OR_TOOLS_BASE_INTEGRAL_TYPES_H_