libnx  v4.8.0
Macros | Functions
crc.h File Reference

Hardware accelerated CRC32 implementation. More...

#include <arm_acle.h>
#include "../types.h"

Go to the source code of this file.

Macros

#define _CRC_ALIGN(sz, insn)
 
#define _CRC_REMAINDER(sz, insn)
 

Functions

static u32 crc32CalculateWithSeed (u32 seed, const void *src, size_t size)
 Calculate a CRC32 over data using a seed. More...
 
static u32 crc32Calculate (const void *src, size_t size)
 Calculate a CRC32 over data.
 
static u32 crc32cCalculateWithSeed (u32 seed, const void *src, size_t size)
 Calculate a CRC32C over data using a seed. More...
 
static u32 crc32cCalculate (const void *src, size_t size)
 Calculate a CRC32C over data.
 

Detailed Description

Hardware accelerated CRC32 implementation.

Macro Definition Documentation

◆ _CRC_ALIGN

#define _CRC_ALIGN (   sz,
  insn 
)
Value:
do { \
if (((uintptr_t)src_u8 & sizeof(sz)) && (u64)len >= sizeof(sz)) { \
crc = __crc32##insn(crc, *((const sz *)src_u8)); \
src_u8 += sizeof(sz); \
len -= sizeof(sz); \
} \
} while (0)
uint64_t u64
64-bit unsigned integer.
Definition: types.h:22

◆ _CRC_REMAINDER

#define _CRC_REMAINDER (   sz,
  insn 
)
Value:
do { \
if (len & sizeof(sz)) { \
crc = __crc32##insn(crc, *((const sz *)src_u8)); \
src_u8 += sizeof(sz); \
} \
} while (0)

Function Documentation

◆ crc32CalculateWithSeed()

static u32 crc32CalculateWithSeed ( u32  seed,
const void *  src,
size_t  size 
)
inlinestatic

Calculate a CRC32 over data using a seed.

Can be used to calculate a CRC32 in chunks using an initial seed of zero for the first chunk.

◆ crc32cCalculateWithSeed()

static u32 crc32cCalculateWithSeed ( u32  seed,
const void *  src,
size_t  size 
)
inlinestatic

Calculate a CRC32C over data using a seed.

Can be used to calculate a CRC32C in chunks using an initial seed of zero for the first chunk.