libaaruformat 1.0
Aaru Data Preservation Suite - Format Library
Loading...
Searching...
No Matches
crc64.h File Reference

CRC64 (ECMA-182) core context and precomputed slicing-by-4 tables. More...

#include <stdint.h>

Go to the source code of this file.

Data Structures

struct  crc64_ctx
 Minimal ECMA-182 CRC64 incremental state container (running value only). More...

Macros

#define CRC64_ECMA_POLY   0xC96C5795D7870F42ULL
 ECMA-182 reflected polynomial constant.
#define CRC64_ECMA_SEED   0xFFFFFFFFFFFFFFFFULL
 ECMA-182 initial seed (all bits set).

Variables

static const uint64_t crc64_table [4][256]
 Precomputed slicing-by-4 ECMA-182 CRC64 lookup tables (4 * 256 * 8 = 8192 bytes).

Detailed Description

CRC64 (ECMA-182) core context and precomputed slicing-by-4 tables.

Exposes:

  • crc64_ctx: minimal incremental state (initialize crc to CRC64_ECMA_SEED).
  • crc64_table[4][256]: 4-way (slicing-by-4) lookup tables for high-throughput updates.
  • CRC64_ECMA_POLY / CRC64_ECMA_SEED macros matching ECMA-182 (reflected polynomial, all-bits-set seed).

Algorithm characteristics:

  • Polynomial: 0xC96C5795D7870F42 (reflected form).
  • Seed / initial value: 0xFFFFFFFFFFFFFFFFULL.
  • Final XOR: none (raw accumulator is the result).
  • Bit order: reflected; least significant bit processed first.

Table layout & optimization: Four 256-entry tables are used (slicing-by-4) allowing 4-byte chunks to be folded per iteration, reducing data dependency chains compared to a single-table approach. This improves throughput on modern CPUs with abundant ILP.

Incremental usage (pseudo-code):

crc64_ctx ctx = { .crc = CRC64_ECMA_SEED };
ctx.crc = crc64_update(ctx.crc, buf, len); // internal helper using crc64_table
// ctx.crc now holds ECMA-182 CRC64 value.
#define CRC64_ECMA_SEED
ECMA-182 initial seed (all bits set).
Definition crc64.h:280
Minimal ECMA-182 CRC64 incremental state container (running value only).
Definition crc64.h:56
uint64_t crc
Running CRC value (initialize to CRC64_ECMA_SEED before first update).
Definition crc64.h:57

Thread safety: The table is read-only; each thread must use its own crc64_ctx. Endianness: Table values are host-endian 64-bit constants; algorithm result is endianness-agnostic.

Definition in file crc64.h.

Macro Definition Documentation

◆ CRC64_ECMA_POLY

#define CRC64_ECMA_POLY   0xC96C5795D7870F42ULL

ECMA-182 reflected polynomial constant.

Definition at line 278 of file crc64.h.

◆ CRC64_ECMA_SEED

#define CRC64_ECMA_SEED   0xFFFFFFFFFFFFFFFFULL

ECMA-182 initial seed (all bits set).

Definition at line 280 of file crc64.h.

Referenced by aaruf_crc64_final(), and aaruf_crc64_init().

Variable Documentation

◆ crc64_table

const uint64_t crc64_table[4][256]
static

Precomputed slicing-by-4 ECMA-182 CRC64 lookup tables (4 * 256 * 8 = 8192 bytes).

Each row corresponds to one byte lane in a 4-byte block update; actual folding logic resides in the implementation. Content generated offline; do not modify manually.

Definition at line 66 of file crc64.h.

Referenced by aaruf_crc64_slicing().