globals.h

来自「Torus 3D Engine is an open-source OpenGL」· C头文件 代码 · 共 82 行

H
82
字号
//////////////////////////////////////////////////////////////////////
//
//	Code extremely based on PCDEZIP.
//
//  Converted into an encapsulated and correctly boundary aligned
//  C++ class by Vander Nunes, 2005.
//
//////////////////////////////////////////////////////////////////////

/* ******************************************************************** *
 *
 *  Inflate Constants
 *
 *  These tables are taken from PKZIP's appnote.txt.
 *
 * ******************************************************************** */

static UINT bll[] =                                // bit length code lengths
    {
			16, 17, 18, 0, 8, 7, 9, 6, 10, 5,
			11, 4, 12, 3, 13, 2, 14, 1, 15
    };

static UINT cll[] =                                // copy lengths for literal ..
    {                                       // ..codes 257 thru 285
			3, 4, 5, 6, 7, 8, 9, 10, 11, 13,
			15, 17, 19, 23, 27, 31, 35, 43,
			51, 59, 67, 83, 99, 115, 131, 163,
			195, 227, 258, 0, 0
    };

static UINT cle[] =                                // extra bits for literal
    {                                       // ..codes 257 thru 285
			0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1,
			1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4,
			4, 4, 5, 5, 5, 5, 0, 99, 99
    };

static UINT cdo[] =                                // copy distance offsets
    {                                       // ..for codes 0 thru 29
			1, 2, 3, 4, 5, 7, 9, 13, 17, 25,
			33, 49, 65, 97, 129, 193, 257, 385,
			513, 769, 1025, 1537, 2049, 3073,
			4097, 6145, 8193, 12289, 16385, 24577
    };

static UINT cde[] =                                // copy extra bits for distance
    {                                       // ..codes 0 thru 29
			0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4,
			5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10,
			11, 11, 12, 12, 13, 13
    };



/* ******************************************************************** *
 *
 *  malloc_chk() -- allocate memory with error processing
 *
 * ******************************************************************** */

void   *malloc_chk(int n)                  // size of block
{
	void   *s;
	s = API_MALLOC(n);
	if (!s)
		return NULL;

	API_MEMSET((char *) s,0,(long) n);		   // else .. clear to nulls
	return(s);                                // ..and return w/address
}

/* ******************************************************************** *
 *
 *  quit_with( char * )
 *
 * ******************************************************************** */
void	quit_with( char *error ) 
{
	//Error( error );
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?