MySQL 9.0.0
Source Code Documentation
software Namespace Reference

Functions

uint64_t swap_byteorder (uint64_t i)
 Swap the byte order of an 8 byte integer. More...
 
static void crc32_slice8_table_init ()
 Initializes the table that is used to generate the CRC32 if the CPU does not have support for it. More...
 
void crc32_8 (uint32_t *crc, const byte **data, size_t *len)
 Calculate CRC32 over 8-bit data using a software implementation. More...
 
uint32_t crc32_64_low (uint32_t crc, uint64_t data)
 Calculate CRC32 over a 64-bit integer using a software implementation. More...
 
static void crc32_64 (uint32_t *crc, const byte **data, size_t *len)
 Calculate CRC32 over 64-bit byte string using a software implementation. More...
 
static void crc32_64_legacy_big_endian (uint32_t *crc, const byte **data, size_t *len)
 Calculate CRC32 over 64-bit byte string using a software implementation. More...
 
template<void crc32_64>
uint32_t crc32_processing_64bit_chunks (const byte *buf, size_t len)
 Calculates CRC32 in software, without using CPU instructions. More...
 
uint32_t crc32 (const byte *buf, size_t len)
 Computes CRC32-C hash not using any hardware acceleration. More...
 

Variables

static uint32_t crc32_slice8_table [8][256]
 
static bool crc32_slice8_table_initialized = false
 

Function Documentation

◆ crc32()

uint32_t software::crc32 ( const byte buf,
size_t  len 
)

Computes CRC32-C hash not using any hardware acceleration.

It's non-static so it can be unit-tested, but otherwise should not be used directly, and thus is not exposed in the header file - use ut_crc32 to benefit from hardware acceleration available.

Parameters
[in]bufdata over which to calculate CRC32
[in]lendata length
Returns
CRC-32C (polynomial 0x11EDC6F41)

◆ crc32_64()

static void software::crc32_64 ( uint32_t *  crc,
const byte **  data,
size_t *  len 
)
inlinestatic

Calculate CRC32 over 64-bit byte string using a software implementation.

Parameters
[in,out]crccrc32 checksum so far when this function is called, when the function ends it will contain the new checksum
[in,out]datadata to be checksummed, the pointer will be advanced with 8 bytes
[in,out]lenremaining bytes, it will be decremented with 8

◆ crc32_64_legacy_big_endian()

static void software::crc32_64_legacy_big_endian ( uint32_t *  crc,
const byte **  data,
size_t *  len 
)
inlinestatic

Calculate CRC32 over 64-bit byte string using a software implementation.

The byte string is converted to a 64-bit integer using big endian byte order.

Parameters
[in,out]crccrc32 checksum so far when this function is called, when the function ends it will contain the new checksum
[in,out]datadata to be checksummed, the pointer will be advanced with 8 bytes
[in,out]lenremaining bytes, it will be decremented with 8

◆ crc32_64_low()

uint32_t software::crc32_64_low ( uint32_t  crc,
uint64_t  data 
)
inline

Calculate CRC32 over a 64-bit integer using a software implementation.

Parameters
[in]crccrc32 checksum so far
[in]datadata to be checksummed
Returns
resulting checksum of crc + crc(data)

◆ crc32_8()

void software::crc32_8 ( uint32_t *  crc,
const byte **  data,
size_t *  len 
)
inline

Calculate CRC32 over 8-bit data using a software implementation.

Parameters
[in,out]crccrc32 checksum so far when this function is called, when the function ends it will contain the new checksum
[in,out]datadata to be checksummed, the pointer will be advanced with 1 byte
[in,out]lenremaining bytes, it will be decremented with 1

◆ crc32_processing_64bit_chunks()

template<void crc32_64>
uint32_t software::crc32_processing_64bit_chunks ( const byte buf,
size_t  len 
)

Calculates CRC32 in software, without using CPU instructions.

Parameters
[in]bufdata over which to calculate CRC32
[in]lendata length
Returns
CRC-32C (polynomial 0x11EDC6F41)

◆ crc32_slice8_table_init()

static void software::crc32_slice8_table_init ( )
static

Initializes the table that is used to generate the CRC32 if the CPU does not have support for it.

◆ swap_byteorder()

uint64_t software::swap_byteorder ( uint64_t  i)
inline

Swap the byte order of an 8 byte integer.

Parameters
[in]i8-byte integer
Returns
8-byte integer

Variable Documentation

◆ crc32_slice8_table

uint32_t software::crc32_slice8_table[8][256]
static

◆ crc32_slice8_table_initialized

bool software::crc32_slice8_table_initialized = false
static