|
2 | 2 | /* |
3 | 3 | * CRC constants generated by: |
4 | 4 | * |
5 | | - * ./scripts/gen-crc-consts.py riscv_clmul crc16_msb_0x8bb7,crc32_msb_0x04c11db7,crc32_lsb_0xedb88320,crc32_lsb_0x82f63b78 |
| 5 | + * ./scripts/gen-crc-consts.py riscv_clmul crc16_msb_0x8bb7,crc32_msb_0x04c11db7,crc32_lsb_0xedb88320,crc32_lsb_0x82f63b78,crc64_msb_0x42f0e1eba9ea3693,crc64_lsb_0x9a6c9329ac4bc9b5 |
6 | 6 | * |
7 | 7 | * Do not edit manually. |
8 | 8 | */ |
@@ -88,3 +88,35 @@ static const struct crc_clmul_consts crc32_lsb_0x82f63b78_consts __maybe_unused |
88 | 88 | .barrett_reduction_const_2 = 0x82f63b78, /* (G - x^32) * x^0 */ |
89 | 89 | #endif |
90 | 90 | }; |
| 91 | + |
| 92 | +/* |
| 93 | + * Constants generated for most-significant-bit-first CRC-64 using |
| 94 | + * G(x) = x^64 + x^62 + x^57 + x^55 + x^54 + x^53 + x^52 + x^47 + x^46 + x^45 + |
| 95 | + * x^40 + x^39 + x^38 + x^37 + x^35 + x^33 + x^32 + x^31 + x^29 + x^27 + |
| 96 | + * x^24 + x^23 + x^22 + x^21 + x^19 + x^17 + x^13 + x^12 + x^10 + x^9 + |
| 97 | + * x^7 + x^4 + x^1 + x^0 |
| 98 | + */ |
| 99 | +#ifdef CONFIG_64BIT |
| 100 | +static const struct crc_clmul_consts crc64_msb_0x42f0e1eba9ea3693_consts __maybe_unused = { |
| 101 | + .fold_across_2_longs_const_hi = 0x4eb938a7d257740e, /* x^192 mod G */ |
| 102 | + .fold_across_2_longs_const_lo = 0x05f5c3c7eb52fab6, /* x^128 mod G */ |
| 103 | + .barrett_reduction_const_1 = 0xabc694e836627c39, /* floor(x^127 / G) */ |
| 104 | + .barrett_reduction_const_2 = 0x42f0e1eba9ea3693, /* G - x^64 */ |
| 105 | +}; |
| 106 | +#endif |
| 107 | + |
| 108 | +/* |
| 109 | + * Constants generated for least-significant-bit-first CRC-64 using |
| 110 | + * G(x) = x^64 + x^63 + x^61 + x^59 + x^58 + x^56 + x^55 + x^52 + x^49 + x^48 + |
| 111 | + * x^47 + x^46 + x^44 + x^41 + x^37 + x^36 + x^34 + x^32 + x^31 + x^28 + |
| 112 | + * x^26 + x^23 + x^22 + x^19 + x^16 + x^13 + x^12 + x^10 + x^9 + x^6 + |
| 113 | + * x^4 + x^3 + x^0 |
| 114 | + */ |
| 115 | +#ifdef CONFIG_64BIT |
| 116 | +static const struct crc_clmul_consts crc64_lsb_0x9a6c9329ac4bc9b5_consts __maybe_unused = { |
| 117 | + .fold_across_2_longs_const_hi = 0xeadc41fd2ba3d420, /* x^191 mod G */ |
| 118 | + .fold_across_2_longs_const_lo = 0x21e9761e252621ac, /* x^127 mod G */ |
| 119 | + .barrett_reduction_const_1 = 0x27ecfa329aef9f77, /* floor(x^127 / G) */ |
| 120 | + .barrett_reduction_const_2 = 0x9a6c9329ac4bc9b5, /* (G - x^64) * x^0 */ |
| 121 | +}; |
| 122 | +#endif |
0 commit comments