<1>c++
#define DEFAULTSIZE 8ide
long AlignUp(long lSize)spa
{內存
return (lSize + DEFAULTSIZE - 1) & ~(DEFAULTSIZE - 1);it
}編譯
<2>class
template< typename N >程序
inline N AlignUp( N n, unsigned long nAlign ) throw()im
{margin
return( N( (n+(nAlign-1))&~(N( nAlign )-1) ) );
}
這個內存分配策略是按什麼分配的
long lTotalSize = AlignUp( lLength+1, 8 );
#ifdef __cplusplus
cout << 「c++」 << endl;
#else
cout << 「c」 << endl;
#endif
#define WORD_LO(x) ((byte)((word)(x)&255))
#define WORD_HI(x) ((byte)((word)(x)>>8))
#define FPOS(type, field)((dword)&((type*)0)->field)
#define FSIZ(type, field)sizeof(((type*)0)->field)
SWAP(x,y){(x)=(x)^(y);(y)=(x)^(y);(x)=(x)^(y);}
a ^= b ^= a;
((a + b) + abs(a - b))/2
((a + b) - abs(a - b))/2