Main Page | Class Hierarchy | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals

l_crc.h File Reference

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Typedefs

typedef unsigned short crc_t

Functions

void CRC_ContinueProcessString (unsigned short *crc, char *data, int length)
void CRC_Init (unsigned short *crcvalue)
void CRC_ProcessByte (unsigned short *crcvalue, byte data)
unsigned short CRC_ProcessString (unsigned char *data, int length)
unsigned short CRC_Value (unsigned short crcvalue)


Typedef Documentation

typedef unsigned short crc_t
 

Definition at line 23 of file l_crc.h.


Function Documentation

void CRC_ContinueProcessString unsigned short *  crc,
char *  data,
int  length
 

Definition at line 143 of file l_crc.c.

References crc, data, and i.

00144 {
00145     int i;
00146 
00147     for (i = 0; i < length; i++)
00148     {
00149         *crc = (*crc << 8) ^ crctable[(*crc >> 8) ^ data[i]];
00150     } //end for
00151 } //end of the function CRC_ProcessString

void CRC_Init unsigned short *  crcvalue  ) 
 

Definition at line 92 of file l_crc.c.

00093 {
00094     *crcvalue = CRC_INIT_VALUE;
00095 } //end of the function CRC_Init

void CRC_ProcessByte unsigned short *  crcvalue,
byte  data
 

Definition at line 102 of file l_crc.c.

00103 {
00104     *crcvalue = (*crcvalue << 8) ^ crctable[(*crcvalue >> 8) ^ data];
00105 } //end of the function CRC_ProcessByte

unsigned short CRC_ProcessString unsigned char *  data,
int  length
 

Definition at line 122 of file l_crc.c.

References CRC_Init(), CRC_Value(), crctable, data, and i.

Referenced by AAS_ReadRouteCache(), and AAS_WriteRouteCache().

00123 {
00124     unsigned short crcvalue;
00125     int i, ind;
00126 
00127     CRC_Init(&crcvalue);
00128 
00129     for (i = 0; i < length; i++)
00130     {
00131         ind = (crcvalue >> 8) ^ data[i];
00132         if (ind < 0 || ind > 256) ind = 0;
00133         crcvalue = (crcvalue << 8) ^ crctable[ind];
00134     } //end for
00135     return CRC_Value(crcvalue);
00136 } //end of the function CRC_ProcessString

Here is the call graph for this function:

unsigned short CRC_Value unsigned short  crcvalue  ) 
 

Definition at line 112 of file l_crc.c.

00113 {
00114     return crcvalue ^ CRC_XOR_VALUE;
00115 } //end of the function CRC_Value


Generated on Thu Aug 25 12:42:44 2005 for Quake III Arena by  doxygen 1.3.9.1