📄 defines.h
字号:
/*
Notice: Copyright(c) 2006-2007 - All Rights Reserved
$Source: H:/SrcBak/cvsroot/clone/protocol/include/defines.h,v $
$Author: Snowtree $
$Revision: 1.1.1.1 $
$Date: 2006/05/18 14:22:28 $
*/
/**
\brief: general defines
*/
#ifndef __DEFINES_H__
#define __DEFINES_H__
/// integer defines
#ifndef _WIN32
typedef signed char INT8;
typedef signed short INT16;
typedef signed long INT32;
typedef signed long long INT64;
typedef unsigned char UINT8;
typedef unsigned short UINT16;
typedef unsigned long UINT32;
typedef unsigned long long UINT64;
#endif //_WIN32
typedef signed char s8;
typedef unsigned char u8;
typedef signed short s16;
typedef unsigned short u16;
#ifdef _WIN32
typedef signed int s32;
typedef unsigned int u32;
#else
typedef signed long s32;
typedef unsigned long u32;
#endif
//typedef signed long long s64;
//typedef unsigned long long u64;
typedef __int64 s64;
typedef unsigned __int64 u64;
/// boolean defines
#ifndef _WIN32
typedef unsigned char BOOL;
#endif //_WIN32
/// define VOID
#ifndef VOID
#define VOID void
typedef char CHAR;
typedef short SHORT;
typedef long LONG;
#endif
#ifndef FALSE
#define FALSE 0
#endif
#ifndef TRUE
#define TRUE 1
#endif
#ifndef FAILURE
#define FAILURE -1
#endif
#ifndef SUCCESS
#define SUCCESS 0
#endif
/// max, min defines
#ifdef __GNUC__
#ifndef min
#define min(x,y) ({ \
const typeof(x) _x = (x); \
const typeof(y) _y = (y); \
/* (void) (&_x == &_y); */ \
_x < _y ? _x : _y; })
#endif
#ifndef max
#define max(x,y) ({ \
const typeof(x) _x = (x); \
const typeof(y) _y = (y); \
/* (void) (&_x == &_y); */ \
_x > _y ? _x : _y; })
#endif
#else //__GNUC__
#ifndef min
#define min(x,y) (((x) < (y)) ? (x) : (y))
#endif
#ifndef max
#define max(x,y) (((x) > (y)) ? (x) : (y))
#endif
#endif
/// alignment defines
#define ALIGN_FLOOR( x, n ) ( (x) & ~((n)-1) )
#define ALIGN_ROUND( x, n ) ALIGN_FLOOR( (x) + ((n)/2), n )
#define ALIGN_CEIL( x, n ) ALIGN_FLOOR( (x) + ((n)-1), n )
/// packed defines, in WIN32 should define #pragma pack(1), #pragma pack()
#ifdef __GNUC__
#define PACKED __attribute__((__packed__))
#else
#define PACKED
#endif
/// const define
#define CONST const
/// inline define
#ifdef _WIN32
#define INLINE __inline
#else
#define INLINE inline
#endif
/// unused parameter defines to suppress not use warning
#define UNUSED_PARAMETER(x) ((void)(x))
/// C link in C++
#ifndef EXTERN_C
#ifdef __cplusplus
#define EXTERN_C extern "C"
#else
#define EXTERN_C
#endif
#endif
#ifdef __cplusplus
#define EXTERN_C_BLOCKSTART extern "C" {
#define EXTERN_C_BLOCKEND }
#else // __cplusplus
#define EXTERN_C_BLOCKSTART
#define EXTERN_C_BLOCKEND
#endif // __cplusplus
#endif //__DEFINES_H__
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -