MySQL 8.0.40
Source Code Documentation
ut0crc32.h File Reference

CRC32 implementation. More...

#include "univ.i"

Go to the source code of this file.

Macros

#define CRC32_DEFAULT
 

Typedefs

typedef uint32_t(* ut_crc32_func_t) (const byte *ptr, size_t len)
 Calculates CRC32. More...
 

Functions

void ut_crc32_init ()
 Initializes the data structures used by ut_crc32*(). More...
 
uint32_t ut_crc32_legacy_big_endian (const byte *buf, size_t len)
 Calculates CRC32 using legacy algorithm, which uses big-endian byte ordering when converting byte sequence to integers - flips each full aligned 8-byte chunk within the buf, but not the initial and trailing unaligned fragments. More...
 

Variables

constexpr uint32_t CRC32C_POLYNOMIAL {0x1EDC6F41}
 The CRC-32C polynomial without the implicit highest 1 at x^32. More...
 
ut_crc32_func_t ut_crc32
 Pointer to standard-compliant CRC32-C (using the GF(2) primitive polynomial 0x11EDC6F41) calculation function picked by ut_crc32_init() as the fastest implementation for the current environment. More...
 
bool ut_crc32_cpu_enabled
 Flag that tells whether the CPU supports CRC32 or not. More...
 
bool ut_poly_mul_cpu_enabled
 Flag that tells whether the CPU supports polynomial multiplication or not. More...
 

Detailed Description

CRC32 implementation.

Created Aug 10, 2011 Vasil Dimov

Macro Definition Documentation

◆ CRC32_DEFAULT

#define CRC32_DEFAULT

Typedef Documentation

◆ ut_crc32_func_t

typedef uint32_t(* ut_crc32_func_t) (const byte *ptr, size_t len)

Calculates CRC32.

Parameters
ptr- data over which to calculate CRC32.
len- data length in bytes.
Returns
calculated hash

Function Documentation

◆ ut_crc32_init()

void ut_crc32_init ( )

Initializes the data structures used by ut_crc32*().

Does not do any allocations, would not hurt if called twice, but would be pointless.

◆ ut_crc32_legacy_big_endian()

uint32_t ut_crc32_legacy_big_endian ( const byte buf,
size_t  len 
)

Calculates CRC32 using legacy algorithm, which uses big-endian byte ordering when converting byte sequence to integers - flips each full aligned 8-byte chunk within the buf, but not the initial and trailing unaligned fragments.

ut_crc32_init() needs to be called at least once before calling this function.

Parameters
[in]bufdata over which to calculate CRC32
[in]lendata length
Returns
calculated hash

Variable Documentation

◆ CRC32C_POLYNOMIAL

constexpr uint32_t CRC32C_POLYNOMIAL {0x1EDC6F41}
constexpr

The CRC-32C polynomial without the implicit highest 1 at x^32.

◆ ut_crc32

ut_crc32_func_t ut_crc32
extern

Pointer to standard-compliant CRC32-C (using the GF(2) primitive polynomial 0x11EDC6F41) calculation function picked by ut_crc32_init() as the fastest implementation for the current environment.

Pointer to standard-compliant CRC32-C (using the GF(2) primitive polynomial 0x11EDC6F41) calculation function picked by ut_crc32_init() as the fastest implementation for the current environment.

The code in this file is used to make a library for external tools. Pointer to CRC32 calculation function.

◆ ut_crc32_cpu_enabled

bool ut_crc32_cpu_enabled
extern

Flag that tells whether the CPU supports CRC32 or not.

◆ ut_poly_mul_cpu_enabled

bool ut_poly_mul_cpu_enabled
extern

Flag that tells whether the CPU supports polynomial multiplication or not.