Turnstone Operating System
Loading...
Searching...
No Matches
crc.h File Reference

crc headers. More...

#include <types.h>

Macros

#define ___CRC_H   0
 
#define CRC32_SEED   0xffffffff
 
#define ADLER32_SEED   1
 

Functions

void crc32_init_table (void)
 initialize crc32 tables for fast calculation
 
uint32_t crc32_sum (const void *p, uint32_t bytelength, uint32_t init)
 calculates crc32 sum More...
 
uint32_t crc32c_sum (const void *data, uint64_t size, uint32_t init)
 calculates crc32c sum More...
 
static uint32_t crc32_finalize (uint32_t crc)
 finalize crc32 sum More...
 
uint32_t adler32_sum (const void *data, uint64_t size, uint32_t init)
 calculates adler32 sum More...
 

Detailed Description

crc headers.

This work is licensed under TURNSTONE OS Public License. Please read and understand latest version of Licence.

Macro Definition Documentation

◆ ___CRC_H

#define ___CRC_H   0

prevent duplicate header error macro

◆ ADLER32_SEED

#define ADLER32_SEED   1

adler32 seed

◆ CRC32_SEED

#define CRC32_SEED   0xffffffff

crc32 seed

Function Documentation

◆ adler32_sum()

uint32_t adler32_sum ( const void *  data,
uint64_t  size,
uint32_t  init 
)

calculates adler32 sum

Parameters
[in]datainput data
[in]sizeinput length
[in]initseed/previous sum
Returns
crc32 sum

◆ crc32_finalize()

static uint32_t crc32_finalize ( uint32_t  crc)
inlinestatic

finalize crc32 sum

Parameters
[in]crcpre crc32 sum
Returns
crc32 sum

◆ crc32_sum()

uint32_t crc32_sum ( const void *  p,
uint32_t  bytelength,
uint32_t  init 
)

calculates crc32 sum

Parameters
[in]pinput data
[in]bytelengthinput length
[in]initCRC32_SEED or previous sum
Returns
pre crc32 sum, for finishing it should be xor'ed with CRC32_SEED

◆ crc32c_sum()

uint32_t crc32c_sum ( const void *  data,
uint64_t  size,
uint32_t  init 
)

calculates crc32c sum

Parameters
[in]datainput data
[in]sizeinput length
[in]initCRC32_SEED or previous sum
Returns
pre crc32 sum, for finishing it should be xor'ed with CRC32_SEED