关闭

跨平台数据类型定义

1354人阅读 评论(0) 收藏 举报
分类:
#if (defined _WIN32) || (defined _WINDOWS_)
#include <afxwin.h>         // MFC 核心组件和标准组件
#else
#include <stdint.h>
typedef uint8_t UINT8;
typedef uint16_t UINT16;
typedef uint32_t UINT32;
typedef uint64_t  UINT64;
typedef int64_t INT64;
typedef unsigned char byte;
typedef unsigned char BYTE;
typedef long LONG;
typedef unsigned long ULONG;
typedef unsigned short WORD;
typedef unsigned long DWORD;
typedef unsigned long  DWORD_PTR;

typedef void * LPVOID;
typedef void *HANDLE;
typedef void * HWND;

typedef long BOOL;
#define TRUE 1
#define FALSE 0

typedef unsigned char UINT8, *PUINT8;
typedef unsigned int UINT;
typedef char _TCHAR;
typedef const char *LPCTSTR;
typedef const char *LPCSTR;
typedef char * PCHAR;
typedef unsigned char UCHAR;
typedef unsigned short USHORT;
typedef DWORD *PDWORD;
typedef BYTE *PBYTE;
typedef wchar_t *LPWSTR;



#define _T(x) x
#define _tcsncicmp strncasecmp
#define _tcsnccmp strncmp
#define _tcschr strchr
#define _tcslen strlen
#define _tclen(p) 1
#define _tcsncpy strncpy
#define _tcscpy strcpy
#define _tccpy(p1,p2) *(p1)=*(p2)
#define _tcstol strtol
#define _tcsncmp strncmp
#define _stprintf sprintf
#define _tcsstr strstr
#define _tfopen fopen
#define _ttoi atoi
#define sprintf_s sprintf
#define sscanf_s sscanf
#define vsprintf_s vsprintf
#define LOWORD(l)           ((WORD)((unsigned long)(l) & 0xffff))
#define HIWORD(l)           ((WORD)((unsigned long)(l) >> 16))

#define Sleep(x) usleep((x) * 1000)
#define MAKELONG(a, b) ((LONG)(((WORD)((DWORD)(a) & 0xffff)) | ((DWORD)((WORD)((DWORD)(b) & 0xffff))) << 16))
#define MAKEWORD(a, b) ((WORD)(((BYTE)(a)) | ((WORD)((BYTE)(b))) << 8))
#define    MAKEUINT16(a, b)         (  (UINT16) ( ((BYTE)((DWORD_PTR)(a) & 0xff)) | ((UINT16)((BYTE)((DWORD_PTR)(b) & 0xff))) << 8 )  )
#define    MAKEUINT32(a, b, c, d)   (  (UINT32) ( ((BYTE)((DWORD_PTR)(a) & 0xff)) | ((UINT32)((BYTE)((DWORD_PTR)(b) & 0xff))) << 8 |  ((UINT32)((BYTE)((DWORD_PTR)(c) & 0xff)) ) << 16  |  ((UINT32)((BYTE)((DWORD_PTR)(d) & 0xff)) ) << 24  ) )
 
#endif


0
0

查看评论
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
    个人资料
    • 访问:246361次
    • 积分:2250
    • 等级:
    • 排名:第16805名
    • 原创:20篇
    • 转载:77篇
    • 译文:0篇
    • 评论:31条
    文章分类
    最新评论