icculus quake2 doxygen  1.0 dev
crc.c File Reference
#include "qcommon.h"

Go to the source code of this file.

Macros

#define CRC_INIT_VALUE   0xffff
 
#define CRC_XOR_VALUE   0x0000
 

Functions

void CRC_Init (unsigned short *crcvalue)
 
void CRC_ProcessByte (unsigned short *crcvalue, byte data)
 
unsigned short CRC_Value (unsigned short crcvalue)
 
unsigned short CRC_Block (byte *start, int count)
 

Variables

static unsigned short crctable [256]
 

Macro Definition Documentation

◆ CRC_INIT_VALUE

#define CRC_INIT_VALUE   0xffff

Definition at line 28 of file crc.c.

◆ CRC_XOR_VALUE

#define CRC_XOR_VALUE   0x0000

Definition at line 29 of file crc.c.

Function Documentation

◆ CRC_Block()

unsigned short CRC_Block ( byte start,
int  count 
)

Definition at line 82 of file crc.c.

83 {
84  unsigned short crc;
85 
86  CRC_Init (&crc);
87  while (count--)
88  crc = (crc << 8) ^ crctable[(crc >> 8) ^ *start++];
89 
90  return crc;
91 }

Referenced by COM_BlockSequenceCRCByte().

◆ CRC_Init()

void CRC_Init ( unsigned short *  crcvalue)

Definition at line 67 of file crc.c.

68 {
69  *crcvalue = CRC_INIT_VALUE;
70 }

Referenced by CRC_Block().

◆ CRC_ProcessByte()

void CRC_ProcessByte ( unsigned short *  crcvalue,
byte  data 
)

Definition at line 72 of file crc.c.

73 {
74  *crcvalue = (*crcvalue << 8) ^ crctable[(*crcvalue >> 8) ^ data];
75 }

◆ CRC_Value()

unsigned short CRC_Value ( unsigned short  crcvalue)

Definition at line 77 of file crc.c.

78 {
79  return crcvalue ^ CRC_XOR_VALUE;
80 }

Variable Documentation

◆ crctable

unsigned short crctable[256]
static

Definition at line 31 of file crc.c.

Referenced by CRC_Block(), and CRC_ProcessByte().

CRC_INIT_VALUE
#define CRC_INIT_VALUE
Definition: crc.c:28
crctable
static unsigned short crctable[256]
Definition: crc.c:31
CRC_XOR_VALUE
#define CRC_XOR_VALUE
Definition: crc.c:29
CRC_Init
void CRC_Init(unsigned short *crcvalue)
Definition: crc.c:67
count
GLint GLsizei count
Definition: qgl_win.c:128