Back to index

avfs  1.0.1
Defines | Functions | Variables
crc32.c File Reference
#include "zlib.h"

Go to the source code of this file.

Defines

#define local   static
#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);

Functions

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

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.

{
    if (buf == Z_NULL) return 0L;
#ifdef DYNAMIC_CRC_TABLE
    if (crc_table_empty)
      make_crc_table();
#endif
    crc = crc ^ 0xffffffffL;
    while (len >= 8)
    {
      DO8(buf);
      len -= 8;
    }
    if (len) do {
      DO1(buf);
    } while (--len);
    return crc ^ 0xffffffffL;
}

Here is the caller graph for this function:

Definition at line 127 of file crc32.c.

{
#ifdef DYNAMIC_CRC_TABLE
  if (crc_table_empty) make_crc_table();
#endif
  return (const uLongf *)crc_table;
}

Variable Documentation

Definition at line 68 of file crc32.c.