1 #ifndef __PORTABLE_H 2 #define __PORTABLE_H 3 4 #include <string.h> 5 #include <stdint.h> 6 7 typedef signed char INT8; 8 typedef unsigned char UINT8; 9 typedef int16_t INT16; 10 typedef uint16_t UINT16; 11 typedef int32_t INT32; 12 typedef uint32_t UINT32; 13 typedef int64_t INT64; 14 typedef uint64_t UINT64; 15 typedef uintptr_t UINT_PTR; 16 typedef int32_t INT; 17 18 typedef UINT8 BYTE; 19 typedef UINT16 WORD; 20 typedef UINT32 DWORD; 21 22 typedef int BOOL; 23 #define FALSE 0 24 #define TRUE 1 25 26 #define HRESULT int 27 #define S_OK 0 28 #define E_INVALIDARG -1 29 #define E_OUTOFMEMORY -2 30 #define E_FAIL -3 31 #define E_INTERNAL_ERROR -4 32 #define E_INVALIDDATA -5 33 MyMin(T a,T b)34template <class T> inline T MyMin(T a, T b) { 35 return a < b ? a : b; 36 } 37 MyMax(T a,T b)38template <class T> inline T MyMax(T a, T b) { 39 return a > b ? a : b; 40 } 41 42 #define RETURN_IF_NOT_S_OK(x) { HRESULT __aResult_ = (x); if(__aResult_ != S_OK) return __aResult_; } 43 44 #endif 45