📄 typ.h
字号:
// typ.h// various types and definitions, some for portability, others for convenience// SafeTP project// copyright SafeTP Development Group, Inc., 2000 Terms of use are as specified in license.txt#ifndef __TYP_H#define __TYP_H// bytetypedef unsigned char byte;typedef signed char signed_byte;// 16-bit integertypedef unsigned short dbyte;typedef signed short signed_dbyte;// 32-bit integertypedef int int32;typedef unsigned int uint32;// NULL#ifndef NULL# define NULL 0#endif // NULL// bool#ifdef LACKS_BOOL typedef int bool; bool const false=0; bool const true=1;#endif // LACKS_BOOL// min, max// changed names to mymin,mymax to avoid problem with gcc-3#ifndef mymin #define mymin(a,b) ((a)<(b)?(a):(b))#endif#ifndef mymax #define mymax(a,b) ((a)>(b)?(a):(b))#endif// tag for definitions of static member functions; there is no// compiler in existence for which this is useful, but I like// to see *something* next to implementations of static members// saying that they are static, and this seems slightly more// formal than just a comment#define STATICDEF /*static*/// often-useful number-of-entries function#define TABLESIZE(tbl) ((int)(sizeof(tbl)/sizeof((tbl)[0])))// concise way to loop on an integer range#define loopi(end) for(int i=0; i<end; i++)#define loopj(end) for(int j=0; j<end; j++)#define loopk(end) for(int k=0; k<end; k++)// for using selfCheck methods// to explicitly check invariants in debug mode#ifndef NDEBUG# define SELFCHECK() selfCheck()#else# define SELFCHECK() ((void)0)#endif// division with rounding towards +inf// (when operands are positive)template <class T>inline T div_up(T const &x, T const &y){ return (x + y - 1) / y; }// mutable#ifdef __BORLANDC__# define MUTABLE# define EXPLICIT#else# define MUTABLE mutable# define EXPLICIT explicit#endif#define SWAP(a,b) \ temp = a; \ a = b; \ b = temp /*user supplies semicolon*/#endif // __TYP_H
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -