xref: /DragonOS/kernel/crates/crc/src/tables/crc64.rs (revision f9fe30be89e89499aad4ef52b4648986bef5a7d8)
1 use core::ops::Deref;
2 
3 #[repr(align(128))]
4 pub struct Crc64Table {
5     pub table: [u64; 256],
6     pub poly: u64,
7 }
8 
9 impl Crc64Table {
10     pub const fn new(poly: u64, table: [u64; 256]) -> Self {
11         Self { poly, table }
12     }
13 }
14 
15 impl Deref for Crc64Table {
16     type Target = [u64; 256];
17 
18     fn deref(&self) -> &Self::Target {
19         &self.table
20     }
21 }
22 
23 pub const CRC64_TABLE: Crc64Table = Crc64Table::new(
24     0x42F0E1EBA9EA3693,
25     [
26         0x0000000000000000,
27         0x42f0e1eba9ea3693,
28         0x85e1c3d753d46d26,
29         0xc711223cfa3e5bb5,
30         0x493366450e42ecdf,
31         0x0bc387aea7a8da4c,
32         0xccd2a5925d9681f9,
33         0x8e224479f47cb76a,
34         0x9266cc8a1c85d9be,
35         0xd0962d61b56fef2d,
36         0x17870f5d4f51b498,
37         0x5577eeb6e6bb820b,
38         0xdb55aacf12c73561,
39         0x99a54b24bb2d03f2,
40         0x5eb4691841135847,
41         0x1c4488f3e8f96ed4,
42         0x663d78ff90e185ef,
43         0x24cd9914390bb37c,
44         0xe3dcbb28c335e8c9,
45         0xa12c5ac36adfde5a,
46         0x2f0e1eba9ea36930,
47         0x6dfeff5137495fa3,
48         0xaaefdd6dcd770416,
49         0xe81f3c86649d3285,
50         0xf45bb4758c645c51,
51         0xb6ab559e258e6ac2,
52         0x71ba77a2dfb03177,
53         0x334a9649765a07e4,
54         0xbd68d2308226b08e,
55         0xff9833db2bcc861d,
56         0x388911e7d1f2dda8,
57         0x7a79f00c7818eb3b,
58         0xcc7af1ff21c30bde,
59         0x8e8a101488293d4d,
60         0x499b3228721766f8,
61         0x0b6bd3c3dbfd506b,
62         0x854997ba2f81e701,
63         0xc7b97651866bd192,
64         0x00a8546d7c558a27,
65         0x4258b586d5bfbcb4,
66         0x5e1c3d753d46d260,
67         0x1cecdc9e94ace4f3,
68         0xdbfdfea26e92bf46,
69         0x990d1f49c77889d5,
70         0x172f5b3033043ebf,
71         0x55dfbadb9aee082c,
72         0x92ce98e760d05399,
73         0xd03e790cc93a650a,
74         0xaa478900b1228e31,
75         0xe8b768eb18c8b8a2,
76         0x2fa64ad7e2f6e317,
77         0x6d56ab3c4b1cd584,
78         0xe374ef45bf6062ee,
79         0xa1840eae168a547d,
80         0x66952c92ecb40fc8,
81         0x2465cd79455e395b,
82         0x3821458aada7578f,
83         0x7ad1a461044d611c,
84         0xbdc0865dfe733aa9,
85         0xff3067b657990c3a,
86         0x711223cfa3e5bb50,
87         0x33e2c2240a0f8dc3,
88         0xf4f3e018f031d676,
89         0xb60301f359dbe0e5,
90         0xda050215ea6c212f,
91         0x98f5e3fe438617bc,
92         0x5fe4c1c2b9b84c09,
93         0x1d14202910527a9a,
94         0x93366450e42ecdf0,
95         0xd1c685bb4dc4fb63,
96         0x16d7a787b7faa0d6,
97         0x5427466c1e109645,
98         0x4863ce9ff6e9f891,
99         0x0a932f745f03ce02,
100         0xcd820d48a53d95b7,
101         0x8f72eca30cd7a324,
102         0x0150a8daf8ab144e,
103         0x43a04931514122dd,
104         0x84b16b0dab7f7968,
105         0xc6418ae602954ffb,
106         0xbc387aea7a8da4c0,
107         0xfec89b01d3679253,
108         0x39d9b93d2959c9e6,
109         0x7b2958d680b3ff75,
110         0xf50b1caf74cf481f,
111         0xb7fbfd44dd257e8c,
112         0x70eadf78271b2539,
113         0x321a3e938ef113aa,
114         0x2e5eb66066087d7e,
115         0x6cae578bcfe24bed,
116         0xabbf75b735dc1058,
117         0xe94f945c9c3626cb,
118         0x676dd025684a91a1,
119         0x259d31cec1a0a732,
120         0xe28c13f23b9efc87,
121         0xa07cf2199274ca14,
122         0x167ff3eacbaf2af1,
123         0x548f120162451c62,
124         0x939e303d987b47d7,
125         0xd16ed1d631917144,
126         0x5f4c95afc5edc62e,
127         0x1dbc74446c07f0bd,
128         0xdaad56789639ab08,
129         0x985db7933fd39d9b,
130         0x84193f60d72af34f,
131         0xc6e9de8b7ec0c5dc,
132         0x01f8fcb784fe9e69,
133         0x43081d5c2d14a8fa,
134         0xcd2a5925d9681f90,
135         0x8fdab8ce70822903,
136         0x48cb9af28abc72b6,
137         0x0a3b7b1923564425,
138         0x70428b155b4eaf1e,
139         0x32b26afef2a4998d,
140         0xf5a348c2089ac238,
141         0xb753a929a170f4ab,
142         0x3971ed50550c43c1,
143         0x7b810cbbfce67552,
144         0xbc902e8706d82ee7,
145         0xfe60cf6caf321874,
146         0xe224479f47cb76a0,
147         0xa0d4a674ee214033,
148         0x67c58448141f1b86,
149         0x253565a3bdf52d15,
150         0xab1721da49899a7f,
151         0xe9e7c031e063acec,
152         0x2ef6e20d1a5df759,
153         0x6c0603e6b3b7c1ca,
154         0xf6fae5c07d3274cd,
155         0xb40a042bd4d8425e,
156         0x731b26172ee619eb,
157         0x31ebc7fc870c2f78,
158         0xbfc9838573709812,
159         0xfd39626eda9aae81,
160         0x3a28405220a4f534,
161         0x78d8a1b9894ec3a7,
162         0x649c294a61b7ad73,
163         0x266cc8a1c85d9be0,
164         0xe17dea9d3263c055,
165         0xa38d0b769b89f6c6,
166         0x2daf4f0f6ff541ac,
167         0x6f5faee4c61f773f,
168         0xa84e8cd83c212c8a,
169         0xeabe6d3395cb1a19,
170         0x90c79d3fedd3f122,
171         0xd2377cd44439c7b1,
172         0x15265ee8be079c04,
173         0x57d6bf0317edaa97,
174         0xd9f4fb7ae3911dfd,
175         0x9b041a914a7b2b6e,
176         0x5c1538adb04570db,
177         0x1ee5d94619af4648,
178         0x02a151b5f156289c,
179         0x4051b05e58bc1e0f,
180         0x87409262a28245ba,
181         0xc5b073890b687329,
182         0x4b9237f0ff14c443,
183         0x0962d61b56fef2d0,
184         0xce73f427acc0a965,
185         0x8c8315cc052a9ff6,
186         0x3a80143f5cf17f13,
187         0x7870f5d4f51b4980,
188         0xbf61d7e80f251235,
189         0xfd913603a6cf24a6,
190         0x73b3727a52b393cc,
191         0x31439391fb59a55f,
192         0xf652b1ad0167feea,
193         0xb4a25046a88dc879,
194         0xa8e6d8b54074a6ad,
195         0xea16395ee99e903e,
196         0x2d071b6213a0cb8b,
197         0x6ff7fa89ba4afd18,
198         0xe1d5bef04e364a72,
199         0xa3255f1be7dc7ce1,
200         0x64347d271de22754,
201         0x26c49cccb40811c7,
202         0x5cbd6cc0cc10fafc,
203         0x1e4d8d2b65facc6f,
204         0xd95caf179fc497da,
205         0x9bac4efc362ea149,
206         0x158e0a85c2521623,
207         0x577eeb6e6bb820b0,
208         0x906fc95291867b05,
209         0xd29f28b9386c4d96,
210         0xcedba04ad0952342,
211         0x8c2b41a1797f15d1,
212         0x4b3a639d83414e64,
213         0x09ca82762aab78f7,
214         0x87e8c60fded7cf9d,
215         0xc51827e4773df90e,
216         0x020905d88d03a2bb,
217         0x40f9e43324e99428,
218         0x2cffe7d5975e55e2,
219         0x6e0f063e3eb46371,
220         0xa91e2402c48a38c4,
221         0xebeec5e96d600e57,
222         0x65cc8190991cb93d,
223         0x273c607b30f68fae,
224         0xe02d4247cac8d41b,
225         0xa2dda3ac6322e288,
226         0xbe992b5f8bdb8c5c,
227         0xfc69cab42231bacf,
228         0x3b78e888d80fe17a,
229         0x7988096371e5d7e9,
230         0xf7aa4d1a85996083,
231         0xb55aacf12c735610,
232         0x724b8ecdd64d0da5,
233         0x30bb6f267fa73b36,
234         0x4ac29f2a07bfd00d,
235         0x08327ec1ae55e69e,
236         0xcf235cfd546bbd2b,
237         0x8dd3bd16fd818bb8,
238         0x03f1f96f09fd3cd2,
239         0x41011884a0170a41,
240         0x86103ab85a2951f4,
241         0xc4e0db53f3c36767,
242         0xd8a453a01b3a09b3,
243         0x9a54b24bb2d03f20,
244         0x5d45907748ee6495,
245         0x1fb5719ce1045206,
246         0x919735e51578e56c,
247         0xd367d40ebc92d3ff,
248         0x1476f63246ac884a,
249         0x568617d9ef46bed9,
250         0xe085162ab69d5e3c,
251         0xa275f7c11f7768af,
252         0x6564d5fde549331a,
253         0x279434164ca30589,
254         0xa9b6706fb8dfb2e3,
255         0xeb46918411358470,
256         0x2c57b3b8eb0bdfc5,
257         0x6ea7525342e1e956,
258         0x72e3daa0aa188782,
259         0x30133b4b03f2b111,
260         0xf7021977f9cceaa4,
261         0xb5f2f89c5026dc37,
262         0x3bd0bce5a45a6b5d,
263         0x79205d0e0db05dce,
264         0xbe317f32f78e067b,
265         0xfcc19ed95e6430e8,
266         0x86b86ed5267cdbd3,
267         0xc4488f3e8f96ed40,
268         0x0359ad0275a8b6f5,
269         0x41a94ce9dc428066,
270         0xcf8b0890283e370c,
271         0x8d7be97b81d4019f,
272         0x4a6acb477bea5a2a,
273         0x089a2aacd2006cb9,
274         0x14dea25f3af9026d,
275         0x562e43b4931334fe,
276         0x913f6188692d6f4b,
277         0xd3cf8063c0c759d8,
278         0x5dedc41a34bbeeb2,
279         0x1f1d25f19d51d821,
280         0xd80c07cd676f8394,
281         0x9afce626ce85b507,
282     ],
283 );
284 
285 pub const CRC64_ROCKSOFT_TABLE: Crc64Table = Crc64Table::new(
286     0x9A6C9329AC4BC9B5,
287     [
288         0x0000000000000000,
289         0x7f6ef0c830358979,
290         0xfedde190606b12f2,
291         0x81b31158505e9b8b,
292         0xc962e5739841b68f,
293         0xb60c15bba8743ff6,
294         0x37bf04e3f82aa47d,
295         0x48d1f42bc81f2d04,
296         0xa61cecb46814fe75,
297         0xd9721c7c5821770c,
298         0x58c10d24087fec87,
299         0x27affdec384a65fe,
300         0x6f7e09c7f05548fa,
301         0x1010f90fc060c183,
302         0x91a3e857903e5a08,
303         0xeecd189fa00bd371,
304         0x78e0ff3b88be6f81,
305         0x078e0ff3b88be6f8,
306         0x863d1eabe8d57d73,
307         0xf953ee63d8e0f40a,
308         0xb1821a4810ffd90e,
309         0xceecea8020ca5077,
310         0x4f5ffbd87094cbfc,
311         0x30310b1040a14285,
312         0xdefc138fe0aa91f4,
313         0xa192e347d09f188d,
314         0x2021f21f80c18306,
315         0x5f4f02d7b0f40a7f,
316         0x179ef6fc78eb277b,
317         0x68f0063448deae02,
318         0xe943176c18803589,
319         0x962de7a428b5bcf0,
320         0xf1c1fe77117cdf02,
321         0x8eaf0ebf2149567b,
322         0x0f1c1fe77117cdf0,
323         0x7072ef2f41224489,
324         0x38a31b04893d698d,
325         0x47cdebccb908e0f4,
326         0xc67efa94e9567b7f,
327         0xb9100a5cd963f206,
328         0x57dd12c379682177,
329         0x28b3e20b495da80e,
330         0xa900f35319033385,
331         0xd66e039b2936bafc,
332         0x9ebff7b0e12997f8,
333         0xe1d10778d11c1e81,
334         0x606216208142850a,
335         0x1f0ce6e8b1770c73,
336         0x8921014c99c2b083,
337         0xf64ff184a9f739fa,
338         0x77fce0dcf9a9a271,
339         0x08921014c99c2b08,
340         0x4043e43f0183060c,
341         0x3f2d14f731b68f75,
342         0xbe9e05af61e814fe,
343         0xc1f0f56751dd9d87,
344         0x2f3dedf8f1d64ef6,
345         0x50531d30c1e3c78f,
346         0xd1e00c6891bd5c04,
347         0xae8efca0a188d57d,
348         0xe65f088b6997f879,
349         0x9931f84359a27100,
350         0x1882e91b09fcea8b,
351         0x67ec19d339c963f2,
352         0xd75adabd7a6e2d6f,
353         0xa8342a754a5ba416,
354         0x29873b2d1a053f9d,
355         0x56e9cbe52a30b6e4,
356         0x1e383fcee22f9be0,
357         0x6156cf06d21a1299,
358         0xe0e5de5e82448912,
359         0x9f8b2e96b271006b,
360         0x71463609127ad31a,
361         0x0e28c6c1224f5a63,
362         0x8f9bd7997211c1e8,
363         0xf0f5275142244891,
364         0xb824d37a8a3b6595,
365         0xc74a23b2ba0eecec,
366         0x46f932eaea507767,
367         0x3997c222da65fe1e,
368         0xafba2586f2d042ee,
369         0xd0d4d54ec2e5cb97,
370         0x5167c41692bb501c,
371         0x2e0934dea28ed965,
372         0x66d8c0f56a91f461,
373         0x19b6303d5aa47d18,
374         0x980521650afae693,
375         0xe76bd1ad3acf6fea,
376         0x09a6c9329ac4bc9b,
377         0x76c839faaaf135e2,
378         0xf77b28a2faafae69,
379         0x8815d86aca9a2710,
380         0xc0c42c4102850a14,
381         0xbfaadc8932b0836d,
382         0x3e19cdd162ee18e6,
383         0x41773d1952db919f,
384         0x269b24ca6b12f26d,
385         0x59f5d4025b277b14,
386         0xd846c55a0b79e09f,
387         0xa72835923b4c69e6,
388         0xeff9c1b9f35344e2,
389         0x90973171c366cd9b,
390         0x1124202993385610,
391         0x6e4ad0e1a30ddf69,
392         0x8087c87e03060c18,
393         0xffe938b633338561,
394         0x7e5a29ee636d1eea,
395         0x0134d92653589793,
396         0x49e52d0d9b47ba97,
397         0x368bddc5ab7233ee,
398         0xb738cc9dfb2ca865,
399         0xc8563c55cb19211c,
400         0x5e7bdbf1e3ac9dec,
401         0x21152b39d3991495,
402         0xa0a63a6183c78f1e,
403         0xdfc8caa9b3f20667,
404         0x97193e827bed2b63,
405         0xe877ce4a4bd8a21a,
406         0x69c4df121b863991,
407         0x16aa2fda2bb3b0e8,
408         0xf86737458bb86399,
409         0x8709c78dbb8deae0,
410         0x06bad6d5ebd3716b,
411         0x79d4261ddbe6f812,
412         0x3105d23613f9d516,
413         0x4e6b22fe23cc5c6f,
414         0xcfd833a67392c7e4,
415         0xb0b6c36e43a74e9d,
416         0x9a6c9329ac4bc9b5,
417         0xe50263e19c7e40cc,
418         0x64b172b9cc20db47,
419         0x1bdf8271fc15523e,
420         0x530e765a340a7f3a,
421         0x2c608692043ff643,
422         0xadd397ca54616dc8,
423         0xd2bd67026454e4b1,
424         0x3c707f9dc45f37c0,
425         0x431e8f55f46abeb9,
426         0xc2ad9e0da4342532,
427         0xbdc36ec59401ac4b,
428         0xf5129aee5c1e814f,
429         0x8a7c6a266c2b0836,
430         0x0bcf7b7e3c7593bd,
431         0x74a18bb60c401ac4,
432         0xe28c6c1224f5a634,
433         0x9de29cda14c02f4d,
434         0x1c518d82449eb4c6,
435         0x633f7d4a74ab3dbf,
436         0x2bee8961bcb410bb,
437         0x548079a98c8199c2,
438         0xd53368f1dcdf0249,
439         0xaa5d9839ecea8b30,
440         0x449080a64ce15841,
441         0x3bfe706e7cd4d138,
442         0xba4d61362c8a4ab3,
443         0xc52391fe1cbfc3ca,
444         0x8df265d5d4a0eece,
445         0xf29c951de49567b7,
446         0x732f8445b4cbfc3c,
447         0x0c41748d84fe7545,
448         0x6bad6d5ebd3716b7,
449         0x14c39d968d029fce,
450         0x95708ccedd5c0445,
451         0xea1e7c06ed698d3c,
452         0xa2cf882d2576a038,
453         0xdda178e515432941,
454         0x5c1269bd451db2ca,
455         0x237c997575283bb3,
456         0xcdb181ead523e8c2,
457         0xb2df7122e51661bb,
458         0x336c607ab548fa30,
459         0x4c0290b2857d7349,
460         0x04d364994d625e4d,
461         0x7bbd94517d57d734,
462         0xfa0e85092d094cbf,
463         0x856075c11d3cc5c6,
464         0x134d926535897936,
465         0x6c2362ad05bcf04f,
466         0xed9073f555e26bc4,
467         0x92fe833d65d7e2bd,
468         0xda2f7716adc8cfb9,
469         0xa54187de9dfd46c0,
470         0x24f29686cda3dd4b,
471         0x5b9c664efd965432,
472         0xb5517ed15d9d8743,
473         0xca3f8e196da80e3a,
474         0x4b8c9f413df695b1,
475         0x34e26f890dc31cc8,
476         0x7c339ba2c5dc31cc,
477         0x035d6b6af5e9b8b5,
478         0x82ee7a32a5b7233e,
479         0xfd808afa9582aa47,
480         0x4d364994d625e4da,
481         0x3258b95ce6106da3,
482         0xb3eba804b64ef628,
483         0xcc8558cc867b7f51,
484         0x8454ace74e645255,
485         0xfb3a5c2f7e51db2c,
486         0x7a894d772e0f40a7,
487         0x05e7bdbf1e3ac9de,
488         0xeb2aa520be311aaf,
489         0x944455e88e0493d6,
490         0x15f744b0de5a085d,
491         0x6a99b478ee6f8124,
492         0x224840532670ac20,
493         0x5d26b09b16452559,
494         0xdc95a1c3461bbed2,
495         0xa3fb510b762e37ab,
496         0x35d6b6af5e9b8b5b,
497         0x4ab846676eae0222,
498         0xcb0b573f3ef099a9,
499         0xb465a7f70ec510d0,
500         0xfcb453dcc6da3dd4,
501         0x83daa314f6efb4ad,
502         0x0269b24ca6b12f26,
503         0x7d0742849684a65f,
504         0x93ca5a1b368f752e,
505         0xeca4aad306bafc57,
506         0x6d17bb8b56e467dc,
507         0x12794b4366d1eea5,
508         0x5aa8bf68aecec3a1,
509         0x25c64fa09efb4ad8,
510         0xa4755ef8cea5d153,
511         0xdb1bae30fe90582a,
512         0xbcf7b7e3c7593bd8,
513         0xc399472bf76cb2a1,
514         0x422a5673a732292a,
515         0x3d44a6bb9707a053,
516         0x759552905f188d57,
517         0x0afba2586f2d042e,
518         0x8b48b3003f739fa5,
519         0xf42643c80f4616dc,
520         0x1aeb5b57af4dc5ad,
521         0x6585ab9f9f784cd4,
522         0xe436bac7cf26d75f,
523         0x9b584a0fff135e26,
524         0xd389be24370c7322,
525         0xace74eec0739fa5b,
526         0x2d545fb4576761d0,
527         0x523aaf7c6752e8a9,
528         0xc41748d84fe75459,
529         0xbb79b8107fd2dd20,
530         0x3acaa9482f8c46ab,
531         0x45a459801fb9cfd2,
532         0x0d75adabd7a6e2d6,
533         0x721b5d63e7936baf,
534         0xf3a84c3bb7cdf024,
535         0x8cc6bcf387f8795d,
536         0x620ba46c27f3aa2c,
537         0x1d6554a417c62355,
538         0x9cd645fc4798b8de,
539         0xe3b8b53477ad31a7,
540         0xab69411fbfb21ca3,
541         0xd407b1d78f8795da,
542         0x55b4a08fdfd90e51,
543         0x2ada5047efec8728,
544     ],
545 );
546