Evince
Evince is a document viewer capable of displaying multiple and single page document formats like PDF and Postscript.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
crc32.c File Reference
#include "unarr-imp.h"
+ Include dependency graph for crc32.c:

Go to the source code of this file.

Functions

uint32_t ar_crc32 (uint32_t crc32, const unsigned char *data, size_t data_len)
 

Variables

static bool crc_table_ready = false
 
static uint32_t crc_table [256]
 

Function Documentation

uint32_t ar_crc32 ( uint32_t  crc32,
const unsigned char *  data,
size_t  data_len 
)

Definition at line 13 of file crc32.c.

14 {
15  if (!crc_table_ready) {
16  uint32_t i, j;
17  uint32_t h = 1;
18  crc_table[0] = 0;
19  for (i = 128; i; i >>= 1) {
20  h = (h >> 1) ^ ((h & 1) ? 0xEDB88320 : 0);
21  for (j = 0; j < 256; j += 2 * i) {
22  crc_table[i + j] = crc_table[j] ^ h;
23  }
24  }
25  crc_table_ready = true;
26  }
27 
28  crc32 = crc32 ^ 0xFFFFFFFF;
29  while (data_len-- > 0) {
30  crc32 = (crc32 >> 8) ^ crc_table[(crc32 ^ *data++) & 0xFF];
31  }
32  return crc32 ^ 0xFFFFFFFF;
33 }

+ Here is the caller graph for this function:

Variable Documentation

uint32_t crc_table[256]
static

Definition at line 11 of file crc32.c.

bool crc_table_ready = false
static

Definition at line 10 of file crc32.c.