src/utilfuns/zlib/crc32.c File Reference

#include "zlib.h"
Include dependency graph for crc32.c:

Go to the source code of this file.

Defines

#define DO1(buf)   crc = crc_table[((int)crc ^ (*buf++)) & 0xff] ^ (crc >> 8);
#define DO2(buf)   DO1(buf); DO1(buf);
#define DO4(buf)   DO2(buf); DO2(buf);
#define DO8(buf)   DO4(buf); DO4(buf);
#define local   static

Functions

uLong ZEXPORT crc32 (uLong crc, const Bytef *buf, uInt len)
const uLongf *ZEXPORT get_crc_table ()

Variables

local const uLongf crc_table [256]

Define Documentation

#define DO1 ( buf   )     crc = crc_table[((int)crc ^ (*buf++)) & 0xff] ^ (crc >> 8);

Definition at line 136 of file crc32.c.

#define DO2 ( buf   )     DO1(buf); DO1(buf);

Definition at line 137 of file crc32.c.

#define DO4 ( buf   )     DO2(buf); DO2(buf);

Definition at line 138 of file crc32.c.

#define DO8 ( buf   )     DO4(buf); DO4(buf);

Definition at line 139 of file crc32.c.

#define local   static

Definition at line 10 of file crc32.c.


Function Documentation

uLong ZEXPORT crc32 ( uLong  crc,
const Bytef buf,
uInt  len 
)

Definition at line 142 of file crc32.c.

00146 {
00147     if (buf == Z_NULL) return 0L;
00148 #ifdef DYNAMIC_CRC_TABLE
00149     if (crc_table_empty)
00150       make_crc_table();
00151 #endif
00152     crc = crc ^ 0xffffffffL;
00153     while (len >= 8)
00154     {
00155       DO8(buf);
00156       len -= 8;
00157     }
00158     if (len) do {
00159       DO1(buf);
00160     } while (--len);
00161     return crc ^ 0xffffffffL;
00162 }

const uLongf* ZEXPORT get_crc_table (  ) 

Definition at line 127 of file crc32.c.

00128 {
00129 #ifdef DYNAMIC_CRC_TABLE
00130   if (crc_table_empty) make_crc_table();
00131 #endif
00132   return (const uLongf *)crc_table;
00133 }


Variable Documentation

local const uLongf crc_table[256]

Definition at line 68 of file crc32.c.


Generated on 18 Mar 2013 for The SWORD Project by  doxygen 1.6.1