Header And Logo

PostgreSQL
| The world's most advanced open source database.

Defines | Functions | Variables

crc32.c File Reference

#include <sys/types.h>
#include <stdio.h>
#include "crc32.h"
Include dependency graph for crc32.c:

Go to the source code of this file.

Defines

#define _CRC32_(crc, ch)   (crc = (crc >> 8) ^ crc32tab[(crc ^ (ch)) & 0xff])

Functions

unsigned int crc32_sz (char *buf, int size)

Variables

static const unsigned int crc32tab [256]

Define Documentation

#define _CRC32_ (   crc,
  ch 
)    (crc = (crc >> 8) ^ crc32tab[(crc ^ (ch)) & 0xff])

Definition at line 19 of file crc32.c.

Referenced by crc32_sz().


Function Documentation

unsigned int crc32_sz ( char *  buf,
int  size 
)

Definition at line 94 of file crc32.c.

References _CRC32_.

Referenced by ghstore_compress(), and ghstore_consistent().

{
    unsigned int crc = ~((unsigned int) 0);
    char       *p;
    int         len,
                nr;

    len = 0;
    nr = size;
    for (len += nr, p = buf; nr--; ++p)
        _CRC32_(crc, *p);
    return ~crc;
}


Variable Documentation

const unsigned int crc32tab[256] [static]

Definition at line 26 of file crc32.c.