lib/crc/riscv/crc-clmul-consts.h
Source file repositories/reference/linux-study-clean/lib/crc/riscv/crc-clmul-consts.h
File Facts
- System
- Linux kernel
- Corpus path
lib/crc/riscv/crc-clmul-consts.h- Extension
.h- Size
- 5357 bytes
- Lines
- 123
- Domain
- Kernel Services
- Bucket
- lib
- Inferred role
- Kernel Services: implementation source
- Status
- source implementation candidate
Why This File Exists
Shared kernel service surface used by multiple subsystems, including helpers, cryptography, virtualization support, and async I/O infrastructure.
- Shared kernel service surface used by multiple subsystems, including helpers, cryptography, virtualization support, and async I/O infrastructure.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
- No C-style include directives detected by the generator.
Detected Declarations
struct crc_clmul_consts
Annotated Snippet
struct crc_clmul_consts {
unsigned long fold_across_2_longs_const_hi;
unsigned long fold_across_2_longs_const_lo;
unsigned long barrett_reduction_const_1;
unsigned long barrett_reduction_const_2;
};
/*
* Constants generated for most-significant-bit-first CRC-16 using
* G(x) = x^16 + x^15 + x^11 + x^9 + x^8 + x^7 + x^5 + x^4 + x^2 + x^1 + x^0
*/
static const struct crc_clmul_consts crc16_msb_0x8bb7_consts __maybe_unused = {
#ifdef CONFIG_64BIT
.fold_across_2_longs_const_hi = 0x0000000000001faa, /* x^192 mod G */
.fold_across_2_longs_const_lo = 0x000000000000a010, /* x^128 mod G */
.barrett_reduction_const_1 = 0xfb2d2bfc0e99d245, /* floor(x^79 / G) */
.barrett_reduction_const_2 = 0x0000000000008bb7, /* G - x^16 */
#else
.fold_across_2_longs_const_hi = 0x00005890, /* x^96 mod G */
.fold_across_2_longs_const_lo = 0x0000f249, /* x^64 mod G */
.barrett_reduction_const_1 = 0xfb2d2bfc, /* floor(x^47 / G) */
.barrett_reduction_const_2 = 0x00008bb7, /* G - x^16 */
#endif
};
/*
* Constants generated for most-significant-bit-first CRC-32 using
* G(x) = x^32 + x^26 + x^23 + x^22 + x^16 + x^12 + x^11 + x^10 + x^8 + x^7 +
* x^5 + x^4 + x^2 + x^1 + x^0
*/
static const struct crc_clmul_consts crc32_msb_0x04c11db7_consts __maybe_unused = {
#ifdef CONFIG_64BIT
.fold_across_2_longs_const_hi = 0x00000000c5b9cd4c, /* x^192 mod G */
.fold_across_2_longs_const_lo = 0x00000000e8a45605, /* x^128 mod G */
.barrett_reduction_const_1 = 0x826880efa40da72d, /* floor(x^95 / G) */
.barrett_reduction_const_2 = 0x0000000004c11db7, /* G - x^32 */
#else
.fold_across_2_longs_const_hi = 0xf200aa66, /* x^96 mod G */
.fold_across_2_longs_const_lo = 0x490d678d, /* x^64 mod G */
.barrett_reduction_const_1 = 0x826880ef, /* floor(x^63 / G) */
.barrett_reduction_const_2 = 0x04c11db7, /* G - x^32 */
#endif
};
/*
* Constants generated for least-significant-bit-first CRC-32 using
* G(x) = x^32 + x^26 + x^23 + x^22 + x^16 + x^12 + x^11 + x^10 + x^8 + x^7 +
* x^5 + x^4 + x^2 + x^1 + x^0
*/
static const struct crc_clmul_consts crc32_lsb_0xedb88320_consts __maybe_unused = {
#ifdef CONFIG_64BIT
.fold_across_2_longs_const_hi = 0x65673b4600000000, /* x^191 mod G */
.fold_across_2_longs_const_lo = 0x9ba54c6f00000000, /* x^127 mod G */
.barrett_reduction_const_1 = 0xb4e5b025f7011641, /* floor(x^95 / G) */
.barrett_reduction_const_2 = 0x00000000edb88320, /* (G - x^32) * x^32 */
#else
.fold_across_2_longs_const_hi = 0xccaa009e, /* x^95 mod G */
.fold_across_2_longs_const_lo = 0xb8bc6765, /* x^63 mod G */
.barrett_reduction_const_1 = 0xf7011641, /* floor(x^63 / G) */
.barrett_reduction_const_2 = 0xedb88320, /* (G - x^32) * x^0 */
#endif
};
/*
* Constants generated for least-significant-bit-first CRC-32 using
* G(x) = x^32 + x^28 + x^27 + x^26 + x^25 + x^23 + x^22 + x^20 + x^19 + x^18 +
* x^14 + x^13 + x^11 + x^10 + x^9 + x^8 + x^6 + x^0
*/
static const struct crc_clmul_consts crc32_lsb_0x82f63b78_consts __maybe_unused = {
#ifdef CONFIG_64BIT
.fold_across_2_longs_const_hi = 0x3743f7bd00000000, /* x^191 mod G */
.fold_across_2_longs_const_lo = 0x3171d43000000000, /* x^127 mod G */
.barrett_reduction_const_1 = 0x4869ec38dea713f1, /* floor(x^95 / G) */
.barrett_reduction_const_2 = 0x0000000082f63b78, /* (G - x^32) * x^32 */
#else
.fold_across_2_longs_const_hi = 0x493c7d27, /* x^95 mod G */
.fold_across_2_longs_const_lo = 0xdd45aab8, /* x^63 mod G */
.barrett_reduction_const_1 = 0xdea713f1, /* floor(x^63 / G) */
.barrett_reduction_const_2 = 0x82f63b78, /* (G - x^32) * x^0 */
#endif
};
/*
* Constants generated for most-significant-bit-first CRC-64 using
* G(x) = x^64 + x^62 + x^57 + x^55 + x^54 + x^53 + x^52 + x^47 + x^46 + x^45 +
* x^40 + x^39 + x^38 + x^37 + x^35 + x^33 + x^32 + x^31 + x^29 + x^27 +
* x^24 + x^23 + x^22 + x^21 + x^19 + x^17 + x^13 + x^12 + x^10 + x^9 +
* x^7 + x^4 + x^1 + x^0
*/
#ifdef CONFIG_64BIT
Annotation
- Detected declarations: `struct crc_clmul_consts`.
- Atlas domain: Kernel Services / lib.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.