zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

blob 795f6a5f (24001B) - Raw


      1 //! This file is auto-generated by tools/update_crc_catalog.zig.
      2 
      3 const builtin = @import("builtin");
      4 
      5 pub const @"CRC-3/GSM" = Generic(u3, .{
      6     .polynomial = 0x3,
      7     .initial = 0x0,
      8     .reflect_input = false,
      9     .reflect_output = false,
     10     .xor_output = 0x7,
     11 });
     12 
     13 pub const @"CRC-3/ROHC" = Generic(u3, .{
     14     .polynomial = 0x3,
     15     .initial = 0x7,
     16     .reflect_input = true,
     17     .reflect_output = true,
     18     .xor_output = 0x0,
     19 });
     20 
     21 pub const @"CRC-4/G-704" = Generic(u4, .{
     22     .polynomial = 0x3,
     23     .initial = 0x0,
     24     .reflect_input = true,
     25     .reflect_output = true,
     26     .xor_output = 0x0,
     27 });
     28 
     29 pub const @"CRC-4/INTERLAKEN" = Generic(u4, .{
     30     .polynomial = 0x3,
     31     .initial = 0xf,
     32     .reflect_input = false,
     33     .reflect_output = false,
     34     .xor_output = 0xf,
     35 });
     36 
     37 pub const @"CRC-5/EPC-C1G2" = Generic(u5, .{
     38     .polynomial = 0x09,
     39     .initial = 0x09,
     40     .reflect_input = false,
     41     .reflect_output = false,
     42     .xor_output = 0x00,
     43 });
     44 
     45 pub const @"CRC-5/G-704" = Generic(u5, .{
     46     .polynomial = 0x15,
     47     .initial = 0x00,
     48     .reflect_input = true,
     49     .reflect_output = true,
     50     .xor_output = 0x00,
     51 });
     52 
     53 pub const @"CRC-5/USB" = Generic(u5, .{
     54     .polynomial = 0x05,
     55     .initial = 0x1f,
     56     .reflect_input = true,
     57     .reflect_output = true,
     58     .xor_output = 0x1f,
     59 });
     60 
     61 pub const @"CRC-6/CDMA2000-A" = Generic(u6, .{
     62     .polynomial = 0x27,
     63     .initial = 0x3f,
     64     .reflect_input = false,
     65     .reflect_output = false,
     66     .xor_output = 0x00,
     67 });
     68 
     69 pub const @"CRC-6/CDMA2000-B" = Generic(u6, .{
     70     .polynomial = 0x07,
     71     .initial = 0x3f,
     72     .reflect_input = false,
     73     .reflect_output = false,
     74     .xor_output = 0x00,
     75 });
     76 
     77 pub const @"CRC-6/DARC" = Generic(u6, .{
     78     .polynomial = 0x19,
     79     .initial = 0x00,
     80     .reflect_input = true,
     81     .reflect_output = true,
     82     .xor_output = 0x00,
     83 });
     84 
     85 pub const @"CRC-6/G-704" = Generic(u6, .{
     86     .polynomial = 0x03,
     87     .initial = 0x00,
     88     .reflect_input = true,
     89     .reflect_output = true,
     90     .xor_output = 0x00,
     91 });
     92 
     93 pub const @"CRC-6/GSM" = Generic(u6, .{
     94     .polynomial = 0x2f,
     95     .initial = 0x00,
     96     .reflect_input = false,
     97     .reflect_output = false,
     98     .xor_output = 0x3f,
     99 });
    100 
    101 pub const @"CRC-7/MMC" = Generic(u7, .{
    102     .polynomial = 0x09,
    103     .initial = 0x00,
    104     .reflect_input = false,
    105     .reflect_output = false,
    106     .xor_output = 0x00,
    107 });
    108 
    109 pub const @"CRC-7/ROHC" = Generic(u7, .{
    110     .polynomial = 0x4f,
    111     .initial = 0x7f,
    112     .reflect_input = true,
    113     .reflect_output = true,
    114     .xor_output = 0x00,
    115 });
    116 
    117 pub const @"CRC-7/UMTS" = Generic(u7, .{
    118     .polynomial = 0x45,
    119     .initial = 0x00,
    120     .reflect_input = false,
    121     .reflect_output = false,
    122     .xor_output = 0x00,
    123 });
    124 
    125 pub const @"CRC-8/AUTOSAR" = Generic(u8, .{
    126     .polynomial = 0x2f,
    127     .initial = 0xff,
    128     .reflect_input = false,
    129     .reflect_output = false,
    130     .xor_output = 0xff,
    131 });
    132 
    133 pub const @"CRC-8/BLUETOOTH" = Generic(u8, .{
    134     .polynomial = 0xa7,
    135     .initial = 0x00,
    136     .reflect_input = true,
    137     .reflect_output = true,
    138     .xor_output = 0x00,
    139 });
    140 
    141 pub const @"CRC-8/CDMA2000" = Generic(u8, .{
    142     .polynomial = 0x9b,
    143     .initial = 0xff,
    144     .reflect_input = false,
    145     .reflect_output = false,
    146     .xor_output = 0x00,
    147 });
    148 
    149 pub const @"CRC-8/DARC" = Generic(u8, .{
    150     .polynomial = 0x39,
    151     .initial = 0x00,
    152     .reflect_input = true,
    153     .reflect_output = true,
    154     .xor_output = 0x00,
    155 });
    156 
    157 pub const @"CRC-8/DVB-S2" = Generic(u8, .{
    158     .polynomial = 0xd5,
    159     .initial = 0x00,
    160     .reflect_input = false,
    161     .reflect_output = false,
    162     .xor_output = 0x00,
    163 });
    164 
    165 pub const @"CRC-8/GSM-A" = Generic(u8, .{
    166     .polynomial = 0x1d,
    167     .initial = 0x00,
    168     .reflect_input = false,
    169     .reflect_output = false,
    170     .xor_output = 0x00,
    171 });
    172 
    173 pub const @"CRC-8/GSM-B" = Generic(u8, .{
    174     .polynomial = 0x49,
    175     .initial = 0x00,
    176     .reflect_input = false,
    177     .reflect_output = false,
    178     .xor_output = 0xff,
    179 });
    180 
    181 pub const @"CRC-8/HITAG" = Generic(u8, .{
    182     .polynomial = 0x1d,
    183     .initial = 0xff,
    184     .reflect_input = false,
    185     .reflect_output = false,
    186     .xor_output = 0x00,
    187 });
    188 
    189 pub const @"CRC-8/I-432-1" = Generic(u8, .{
    190     .polynomial = 0x07,
    191     .initial = 0x00,
    192     .reflect_input = false,
    193     .reflect_output = false,
    194     .xor_output = 0x55,
    195 });
    196 
    197 pub const @"CRC-8/I-CODE" = Generic(u8, .{
    198     .polynomial = 0x1d,
    199     .initial = 0xfd,
    200     .reflect_input = false,
    201     .reflect_output = false,
    202     .xor_output = 0x00,
    203 });
    204 
    205 pub const @"CRC-8/LTE" = Generic(u8, .{
    206     .polynomial = 0x9b,
    207     .initial = 0x00,
    208     .reflect_input = false,
    209     .reflect_output = false,
    210     .xor_output = 0x00,
    211 });
    212 
    213 pub const @"CRC-8/MAXIM-DOW" = Generic(u8, .{
    214     .polynomial = 0x31,
    215     .initial = 0x00,
    216     .reflect_input = true,
    217     .reflect_output = true,
    218     .xor_output = 0x00,
    219 });
    220 
    221 pub const @"CRC-8/MIFARE-MAD" = Generic(u8, .{
    222     .polynomial = 0x1d,
    223     .initial = 0xc7,
    224     .reflect_input = false,
    225     .reflect_output = false,
    226     .xor_output = 0x00,
    227 });
    228 
    229 pub const @"CRC-8/NRSC-5" = Generic(u8, .{
    230     .polynomial = 0x31,
    231     .initial = 0xff,
    232     .reflect_input = false,
    233     .reflect_output = false,
    234     .xor_output = 0x00,
    235 });
    236 
    237 pub const @"CRC-8/OPENSAFETY" = Generic(u8, .{
    238     .polynomial = 0x2f,
    239     .initial = 0x00,
    240     .reflect_input = false,
    241     .reflect_output = false,
    242     .xor_output = 0x00,
    243 });
    244 
    245 pub const @"CRC-8/ROHC" = Generic(u8, .{
    246     .polynomial = 0x07,
    247     .initial = 0xff,
    248     .reflect_input = true,
    249     .reflect_output = true,
    250     .xor_output = 0x00,
    251 });
    252 
    253 pub const @"CRC-8/SAE-J1850" = Generic(u8, .{
    254     .polynomial = 0x1d,
    255     .initial = 0xff,
    256     .reflect_input = false,
    257     .reflect_output = false,
    258     .xor_output = 0xff,
    259 });
    260 
    261 pub const @"CRC-8/SMBUS" = Generic(u8, .{
    262     .polynomial = 0x07,
    263     .initial = 0x00,
    264     .reflect_input = false,
    265     .reflect_output = false,
    266     .xor_output = 0x00,
    267 });
    268 
    269 pub const @"CRC-8/TECH-3250" = Generic(u8, .{
    270     .polynomial = 0x1d,
    271     .initial = 0xff,
    272     .reflect_input = true,
    273     .reflect_output = true,
    274     .xor_output = 0x00,
    275 });
    276 
    277 pub const @"CRC-8/WCDMA" = Generic(u8, .{
    278     .polynomial = 0x9b,
    279     .initial = 0x00,
    280     .reflect_input = true,
    281     .reflect_output = true,
    282     .xor_output = 0x00,
    283 });
    284 
    285 pub const @"CRC-10/ATM" = Generic(u10, .{
    286     .polynomial = 0x233,
    287     .initial = 0x000,
    288     .reflect_input = false,
    289     .reflect_output = false,
    290     .xor_output = 0x000,
    291 });
    292 
    293 pub const @"CRC-10/CDMA2000" = Generic(u10, .{
    294     .polynomial = 0x3d9,
    295     .initial = 0x3ff,
    296     .reflect_input = false,
    297     .reflect_output = false,
    298     .xor_output = 0x000,
    299 });
    300 
    301 pub const @"CRC-10/GSM" = Generic(u10, .{
    302     .polynomial = 0x175,
    303     .initial = 0x000,
    304     .reflect_input = false,
    305     .reflect_output = false,
    306     .xor_output = 0x3ff,
    307 });
    308 
    309 pub const @"CRC-11/FLEXRAY" = Generic(u11, .{
    310     .polynomial = 0x385,
    311     .initial = 0x01a,
    312     .reflect_input = false,
    313     .reflect_output = false,
    314     .xor_output = 0x000,
    315 });
    316 
    317 pub const @"CRC-11/UMTS" = Generic(u11, .{
    318     .polynomial = 0x307,
    319     .initial = 0x000,
    320     .reflect_input = false,
    321     .reflect_output = false,
    322     .xor_output = 0x000,
    323 });
    324 
    325 pub const @"CRC-12/CDMA2000" = Generic(u12, .{
    326     .polynomial = 0xf13,
    327     .initial = 0xfff,
    328     .reflect_input = false,
    329     .reflect_output = false,
    330     .xor_output = 0x000,
    331 });
    332 
    333 pub const @"CRC-12/DECT" = Generic(u12, .{
    334     .polynomial = 0x80f,
    335     .initial = 0x000,
    336     .reflect_input = false,
    337     .reflect_output = false,
    338     .xor_output = 0x000,
    339 });
    340 
    341 pub const @"CRC-12/GSM" = Generic(u12, .{
    342     .polynomial = 0xd31,
    343     .initial = 0x000,
    344     .reflect_input = false,
    345     .reflect_output = false,
    346     .xor_output = 0xfff,
    347 });
    348 
    349 pub const @"CRC-12/UMTS" = Generic(u12, .{
    350     .polynomial = 0x80f,
    351     .initial = 0x000,
    352     .reflect_input = false,
    353     .reflect_output = true,
    354     .xor_output = 0x000,
    355 });
    356 
    357 pub const @"CRC-13/BBC" = Generic(u13, .{
    358     .polynomial = 0x1cf5,
    359     .initial = 0x0000,
    360     .reflect_input = false,
    361     .reflect_output = false,
    362     .xor_output = 0x0000,
    363 });
    364 
    365 pub const @"CRC-14/DARC" = Generic(u14, .{
    366     .polynomial = 0x0805,
    367     .initial = 0x0000,
    368     .reflect_input = true,
    369     .reflect_output = true,
    370     .xor_output = 0x0000,
    371 });
    372 
    373 pub const @"CRC-14/GSM" = Generic(u14, .{
    374     .polynomial = 0x202d,
    375     .initial = 0x0000,
    376     .reflect_input = false,
    377     .reflect_output = false,
    378     .xor_output = 0x3fff,
    379 });
    380 
    381 pub const @"CRC-15/CAN" = Generic(u15, .{
    382     .polynomial = 0x4599,
    383     .initial = 0x0000,
    384     .reflect_input = false,
    385     .reflect_output = false,
    386     .xor_output = 0x0000,
    387 });
    388 
    389 pub const @"CRC-15/MPT1327" = Generic(u15, .{
    390     .polynomial = 0x6815,
    391     .initial = 0x0000,
    392     .reflect_input = false,
    393     .reflect_output = false,
    394     .xor_output = 0x0001,
    395 });
    396 
    397 pub const @"CRC-16/ARC" = Generic(u16, .{
    398     .polynomial = 0x8005,
    399     .initial = 0x0000,
    400     .reflect_input = true,
    401     .reflect_output = true,
    402     .xor_output = 0x0000,
    403 });
    404 
    405 pub const @"CRC-16/CDMA2000" = Generic(u16, .{
    406     .polynomial = 0xc867,
    407     .initial = 0xffff,
    408     .reflect_input = false,
    409     .reflect_output = false,
    410     .xor_output = 0x0000,
    411 });
    412 
    413 pub const @"CRC-16/CMS" = Generic(u16, .{
    414     .polynomial = 0x8005,
    415     .initial = 0xffff,
    416     .reflect_input = false,
    417     .reflect_output = false,
    418     .xor_output = 0x0000,
    419 });
    420 
    421 pub const @"CRC-16/DDS-110" = Generic(u16, .{
    422     .polynomial = 0x8005,
    423     .initial = 0x800d,
    424     .reflect_input = false,
    425     .reflect_output = false,
    426     .xor_output = 0x0000,
    427 });
    428 
    429 pub const @"CRC-16/DECT-R" = Generic(u16, .{
    430     .polynomial = 0x0589,
    431     .initial = 0x0000,
    432     .reflect_input = false,
    433     .reflect_output = false,
    434     .xor_output = 0x0001,
    435 });
    436 
    437 pub const @"CRC-16/DECT-X" = Generic(u16, .{
    438     .polynomial = 0x0589,
    439     .initial = 0x0000,
    440     .reflect_input = false,
    441     .reflect_output = false,
    442     .xor_output = 0x0000,
    443 });
    444 
    445 pub const @"CRC-16/DNP" = Generic(u16, .{
    446     .polynomial = 0x3d65,
    447     .initial = 0x0000,
    448     .reflect_input = true,
    449     .reflect_output = true,
    450     .xor_output = 0xffff,
    451 });
    452 
    453 pub const @"CRC-16/EN-13757" = Generic(u16, .{
    454     .polynomial = 0x3d65,
    455     .initial = 0x0000,
    456     .reflect_input = false,
    457     .reflect_output = false,
    458     .xor_output = 0xffff,
    459 });
    460 
    461 pub const @"CRC-16/GENIBUS" = Generic(u16, .{
    462     .polynomial = 0x1021,
    463     .initial = 0xffff,
    464     .reflect_input = false,
    465     .reflect_output = false,
    466     .xor_output = 0xffff,
    467 });
    468 
    469 pub const @"CRC-16/GSM" = Generic(u16, .{
    470     .polynomial = 0x1021,
    471     .initial = 0x0000,
    472     .reflect_input = false,
    473     .reflect_output = false,
    474     .xor_output = 0xffff,
    475 });
    476 
    477 pub const @"CRC-16/IBM-3740" = Generic(u16, .{
    478     .polynomial = 0x1021,
    479     .initial = 0xffff,
    480     .reflect_input = false,
    481     .reflect_output = false,
    482     .xor_output = 0x0000,
    483 });
    484 
    485 pub const @"CRC-16/IBM-SDLC" = Generic(u16, .{
    486     .polynomial = 0x1021,
    487     .initial = 0xffff,
    488     .reflect_input = true,
    489     .reflect_output = true,
    490     .xor_output = 0xffff,
    491 });
    492 
    493 pub const @"CRC-16/ISO-IEC-14443-3-A" = Generic(u16, .{
    494     .polynomial = 0x1021,
    495     .initial = 0xc6c6,
    496     .reflect_input = true,
    497     .reflect_output = true,
    498     .xor_output = 0x0000,
    499 });
    500 
    501 pub const @"CRC-16/KERMIT" = Generic(u16, .{
    502     .polynomial = 0x1021,
    503     .initial = 0x0000,
    504     .reflect_input = true,
    505     .reflect_output = true,
    506     .xor_output = 0x0000,
    507 });
    508 
    509 pub const @"CRC-16/LJ1200" = Generic(u16, .{
    510     .polynomial = 0x6f63,
    511     .initial = 0x0000,
    512     .reflect_input = false,
    513     .reflect_output = false,
    514     .xor_output = 0x0000,
    515 });
    516 
    517 pub const @"CRC-16/M17" = Generic(u16, .{
    518     .polynomial = 0x5935,
    519     .initial = 0xffff,
    520     .reflect_input = false,
    521     .reflect_output = false,
    522     .xor_output = 0x0000,
    523 });
    524 
    525 pub const @"CRC-16/MAXIM-DOW" = Generic(u16, .{
    526     .polynomial = 0x8005,
    527     .initial = 0x0000,
    528     .reflect_input = true,
    529     .reflect_output = true,
    530     .xor_output = 0xffff,
    531 });
    532 
    533 pub const @"CRC-16/MCRF4XX" = Generic(u16, .{
    534     .polynomial = 0x1021,
    535     .initial = 0xffff,
    536     .reflect_input = true,
    537     .reflect_output = true,
    538     .xor_output = 0x0000,
    539 });
    540 
    541 pub const @"CRC-16/MODBUS" = Generic(u16, .{
    542     .polynomial = 0x8005,
    543     .initial = 0xffff,
    544     .reflect_input = true,
    545     .reflect_output = true,
    546     .xor_output = 0x0000,
    547 });
    548 
    549 pub const @"CRC-16/NRSC-5" = Generic(u16, .{
    550     .polynomial = 0x080b,
    551     .initial = 0xffff,
    552     .reflect_input = true,
    553     .reflect_output = true,
    554     .xor_output = 0x0000,
    555 });
    556 
    557 pub const @"CRC-16/OPENSAFETY-A" = Generic(u16, .{
    558     .polynomial = 0x5935,
    559     .initial = 0x0000,
    560     .reflect_input = false,
    561     .reflect_output = false,
    562     .xor_output = 0x0000,
    563 });
    564 
    565 pub const @"CRC-16/OPENSAFETY-B" = Generic(u16, .{
    566     .polynomial = 0x755b,
    567     .initial = 0x0000,
    568     .reflect_input = false,
    569     .reflect_output = false,
    570     .xor_output = 0x0000,
    571 });
    572 
    573 pub const @"CRC-16/PROFIBUS" = Generic(u16, .{
    574     .polynomial = 0x1dcf,
    575     .initial = 0xffff,
    576     .reflect_input = false,
    577     .reflect_output = false,
    578     .xor_output = 0xffff,
    579 });
    580 
    581 pub const @"CRC-16/RIELLO" = Generic(u16, .{
    582     .polynomial = 0x1021,
    583     .initial = 0xb2aa,
    584     .reflect_input = true,
    585     .reflect_output = true,
    586     .xor_output = 0x0000,
    587 });
    588 
    589 pub const @"CRC-16/SPI-FUJITSU" = Generic(u16, .{
    590     .polynomial = 0x1021,
    591     .initial = 0x1d0f,
    592     .reflect_input = false,
    593     .reflect_output = false,
    594     .xor_output = 0x0000,
    595 });
    596 
    597 pub const @"CRC-16/T10-DIF" = Generic(u16, .{
    598     .polynomial = 0x8bb7,
    599     .initial = 0x0000,
    600     .reflect_input = false,
    601     .reflect_output = false,
    602     .xor_output = 0x0000,
    603 });
    604 
    605 pub const @"CRC-16/TELEDISK" = Generic(u16, .{
    606     .polynomial = 0xa097,
    607     .initial = 0x0000,
    608     .reflect_input = false,
    609     .reflect_output = false,
    610     .xor_output = 0x0000,
    611 });
    612 
    613 pub const @"CRC-16/TMS37157" = Generic(u16, .{
    614     .polynomial = 0x1021,
    615     .initial = 0x89ec,
    616     .reflect_input = true,
    617     .reflect_output = true,
    618     .xor_output = 0x0000,
    619 });
    620 
    621 pub const @"CRC-16/UMTS" = Generic(u16, .{
    622     .polynomial = 0x8005,
    623     .initial = 0x0000,
    624     .reflect_input = false,
    625     .reflect_output = false,
    626     .xor_output = 0x0000,
    627 });
    628 
    629 pub const @"CRC-16/USB" = Generic(u16, .{
    630     .polynomial = 0x8005,
    631     .initial = 0xffff,
    632     .reflect_input = true,
    633     .reflect_output = true,
    634     .xor_output = 0xffff,
    635 });
    636 
    637 pub const @"CRC-16/XMODEM" = Generic(u16, .{
    638     .polynomial = 0x1021,
    639     .initial = 0x0000,
    640     .reflect_input = false,
    641     .reflect_output = false,
    642     .xor_output = 0x0000,
    643 });
    644 
    645 pub const @"CRC-17/CAN-FD" = Generic(u17, .{
    646     .polynomial = 0x1685b,
    647     .initial = 0x00000,
    648     .reflect_input = false,
    649     .reflect_output = false,
    650     .xor_output = 0x00000,
    651 });
    652 
    653 pub const @"CRC-21/CAN-FD" = Generic(u21, .{
    654     .polynomial = 0x102899,
    655     .initial = 0x000000,
    656     .reflect_input = false,
    657     .reflect_output = false,
    658     .xor_output = 0x000000,
    659 });
    660 
    661 pub const @"CRC-24/BLE" = Generic(u24, .{
    662     .polynomial = 0x00065b,
    663     .initial = 0x555555,
    664     .reflect_input = true,
    665     .reflect_output = true,
    666     .xor_output = 0x000000,
    667 });
    668 
    669 pub const @"CRC-24/FLEXRAY-A" = Generic(u24, .{
    670     .polynomial = 0x5d6dcb,
    671     .initial = 0xfedcba,
    672     .reflect_input = false,
    673     .reflect_output = false,
    674     .xor_output = 0x000000,
    675 });
    676 
    677 pub const @"CRC-24/FLEXRAY-B" = Generic(u24, .{
    678     .polynomial = 0x5d6dcb,
    679     .initial = 0xabcdef,
    680     .reflect_input = false,
    681     .reflect_output = false,
    682     .xor_output = 0x000000,
    683 });
    684 
    685 pub const @"CRC-24/INTERLAKEN" = Generic(u24, .{
    686     .polynomial = 0x328b63,
    687     .initial = 0xffffff,
    688     .reflect_input = false,
    689     .reflect_output = false,
    690     .xor_output = 0xffffff,
    691 });
    692 
    693 pub const @"CRC-24/LTE-A" = Generic(u24, .{
    694     .polynomial = 0x864cfb,
    695     .initial = 0x000000,
    696     .reflect_input = false,
    697     .reflect_output = false,
    698     .xor_output = 0x000000,
    699 });
    700 
    701 pub const @"CRC-24/LTE-B" = Generic(u24, .{
    702     .polynomial = 0x800063,
    703     .initial = 0x000000,
    704     .reflect_input = false,
    705     .reflect_output = false,
    706     .xor_output = 0x000000,
    707 });
    708 
    709 pub const @"CRC-24/OPENPGP" = Generic(u24, .{
    710     .polynomial = 0x864cfb,
    711     .initial = 0xb704ce,
    712     .reflect_input = false,
    713     .reflect_output = false,
    714     .xor_output = 0x000000,
    715 });
    716 
    717 pub const @"CRC-24/OS-9" = Generic(u24, .{
    718     .polynomial = 0x800063,
    719     .initial = 0xffffff,
    720     .reflect_input = false,
    721     .reflect_output = false,
    722     .xor_output = 0xffffff,
    723 });
    724 
    725 pub const @"CRC-30/CDMA" = Generic(u30, .{
    726     .polynomial = 0x2030b9c7,
    727     .initial = 0x3fffffff,
    728     .reflect_input = false,
    729     .reflect_output = false,
    730     .xor_output = 0x3fffffff,
    731 });
    732 
    733 pub const @"CRC-31/PHILIPS" = Generic(u31, .{
    734     .polynomial = 0x04c11db7,
    735     .initial = 0x7fffffff,
    736     .reflect_input = false,
    737     .reflect_output = false,
    738     .xor_output = 0x7fffffff,
    739 });
    740 
    741 pub const @"CRC-32/AIXM" = Generic(u32, .{
    742     .polynomial = 0x814141ab,
    743     .initial = 0x00000000,
    744     .reflect_input = false,
    745     .reflect_output = false,
    746     .xor_output = 0x00000000,
    747 });
    748 
    749 pub const @"CRC-32/AUTOSAR" = Generic(u32, .{
    750     .polynomial = 0xf4acfb13,
    751     .initial = 0xffffffff,
    752     .reflect_input = true,
    753     .reflect_output = true,
    754     .xor_output = 0xffffffff,
    755 });
    756 
    757 pub const @"CRC-32/BASE91-D" = Generic(u32, .{
    758     .polynomial = 0xa833982b,
    759     .initial = 0xffffffff,
    760     .reflect_input = true,
    761     .reflect_output = true,
    762     .xor_output = 0xffffffff,
    763 });
    764 
    765 pub const @"CRC-32/BZIP2" = Generic(u32, .{
    766     .polynomial = 0x04c11db7,
    767     .initial = 0xffffffff,
    768     .reflect_input = false,
    769     .reflect_output = false,
    770     .xor_output = 0xffffffff,
    771 });
    772 
    773 pub const @"CRC-32/CD-ROM-EDC" = Generic(u32, .{
    774     .polynomial = 0x8001801b,
    775     .initial = 0x00000000,
    776     .reflect_input = true,
    777     .reflect_output = true,
    778     .xor_output = 0x00000000,
    779 });
    780 
    781 pub const @"CRC-32/CKSUM" = Generic(u32, .{
    782     .polynomial = 0x04c11db7,
    783     .initial = 0x00000000,
    784     .reflect_input = false,
    785     .reflect_output = false,
    786     .xor_output = 0xffffffff,
    787 });
    788 
    789 pub const @"CRC-32/ISCSI" = if (builtin.cpu.hasAll(.x86, &.{ .@"64bit", .crc32 }))
    790     @import("crc/Crc32c.zig")
    791 else
    792     Generic(u32, .{
    793         .polynomial = 0x1edc6f41,
    794         .initial = 0xffffffff,
    795         .reflect_input = true,
    796         .reflect_output = true,
    797         .xor_output = 0xffffffff,
    798     });
    799 
    800 pub const @"CRC-32/ISO-HDLC" = Generic(u32, .{
    801     .polynomial = 0x04c11db7,
    802     .initial = 0xffffffff,
    803     .reflect_input = true,
    804     .reflect_output = true,
    805     .xor_output = 0xffffffff,
    806 });
    807 
    808 pub const @"CRC-32/JAMCRC" = Generic(u32, .{
    809     .polynomial = 0x04c11db7,
    810     .initial = 0xffffffff,
    811     .reflect_input = true,
    812     .reflect_output = true,
    813     .xor_output = 0x00000000,
    814 });
    815 
    816 pub const @"CRC-32/KOOPMAN" = Generic(u32, .{
    817     .polynomial = 0x741b8cd7,
    818     .initial = 0xffffffff,
    819     .reflect_input = true,
    820     .reflect_output = true,
    821     .xor_output = 0xffffffff,
    822 });
    823 
    824 pub const @"CRC-32/MEF" = Generic(u32, .{
    825     .polynomial = 0x741b8cd7,
    826     .initial = 0xffffffff,
    827     .reflect_input = true,
    828     .reflect_output = true,
    829     .xor_output = 0x00000000,
    830 });
    831 
    832 pub const @"CRC-32/MPEG-2" = Generic(u32, .{
    833     .polynomial = 0x04c11db7,
    834     .initial = 0xffffffff,
    835     .reflect_input = false,
    836     .reflect_output = false,
    837     .xor_output = 0x00000000,
    838 });
    839 
    840 pub const @"CRC-32/XFER" = Generic(u32, .{
    841     .polynomial = 0x000000af,
    842     .initial = 0x00000000,
    843     .reflect_input = false,
    844     .reflect_output = false,
    845     .xor_output = 0x00000000,
    846 });
    847 
    848 pub const @"CRC-40/GSM" = Generic(u40, .{
    849     .polynomial = 0x0004820009,
    850     .initial = 0x0000000000,
    851     .reflect_input = false,
    852     .reflect_output = false,
    853     .xor_output = 0xffffffffff,
    854 });
    855 
    856 pub const @"CRC-64/ECMA-182" = Generic(u64, .{
    857     .polynomial = 0x42f0e1eba9ea3693,
    858     .initial = 0x0000000000000000,
    859     .reflect_input = false,
    860     .reflect_output = false,
    861     .xor_output = 0x0000000000000000,
    862 });
    863 
    864 pub const @"CRC-64/GO-ISO" = Generic(u64, .{
    865     .polynomial = 0x000000000000001b,
    866     .initial = 0xffffffffffffffff,
    867     .reflect_input = true,
    868     .reflect_output = true,
    869     .xor_output = 0xffffffffffffffff,
    870 });
    871 
    872 pub const @"CRC-64/MS" = Generic(u64, .{
    873     .polynomial = 0x259c84cba6426349,
    874     .initial = 0xffffffffffffffff,
    875     .reflect_input = true,
    876     .reflect_output = true,
    877     .xor_output = 0x0000000000000000,
    878 });
    879 
    880 pub const @"CRC-64/REDIS" = Generic(u64, .{
    881     .polynomial = 0xad93d23594c935a9,
    882     .initial = 0x0000000000000000,
    883     .reflect_input = true,
    884     .reflect_output = true,
    885     .xor_output = 0x0000000000000000,
    886 });
    887 
    888 pub const @"CRC-64/WE" = Generic(u64, .{
    889     .polynomial = 0x42f0e1eba9ea3693,
    890     .initial = 0xffffffffffffffff,
    891     .reflect_input = false,
    892     .reflect_output = false,
    893     .xor_output = 0xffffffffffffffff,
    894 });
    895 
    896 pub const @"CRC-64/XZ" = Generic(u64, .{
    897     .polynomial = 0x42f0e1eba9ea3693,
    898     .initial = 0xffffffffffffffff,
    899     .reflect_input = true,
    900     .reflect_output = true,
    901     .xor_output = 0xffffffffffffffff,
    902 });
    903 
    904 pub const @"CRC-82/DARC" = Generic(u82, .{
    905     .polynomial = 0x0308c0111011401440411,
    906     .initial = 0x000000000000000000000,
    907     .reflect_input = true,
    908     .reflect_output = true,
    909     .xor_output = 0x000000000000000000000,
    910 });
    911 
    912 pub fn Algorithm(comptime W: type) type {
    913     return struct {
    914         polynomial: W,
    915         initial: W,
    916         reflect_input: bool,
    917         reflect_output: bool,
    918         xor_output: W,
    919     };
    920 }
    921 
    922 pub fn Generic(comptime W: type, comptime algorithm: Algorithm(W)) type {
    923     return struct {
    924         const Self = @This();
    925         const I = if (@bitSizeOf(W) < 8) u8 else W;
    926         const lookup_table = blk: {
    927             @setEvalBranchQuota(2500);
    928             const poly = reflect(algorithm.polynomial);
    929             var table: [256]I = undefined;
    930             for (&table, 0..) |*e, i| {
    931                 var crc: I = i;
    932                 if (algorithm.reflect_input) {
    933                     var j: usize = 0;
    934                     while (j < 8) : (j += 1) {
    935                         crc = (crc >> 1) ^ ((crc & 1) * poly);
    936                     }
    937                 } else {
    938                     crc <<= @bitSizeOf(I) - 8;
    939                     var j: usize = 0;
    940                     while (j < 8) : (j += 1) {
    941                         crc = (crc << 1) ^ (((crc >> (@bitSizeOf(I) - 1)) & 1) * poly);
    942                     }
    943                 }
    944                 e.* = crc;
    945             }
    946             break :blk table;
    947         };
    948 
    949         crc: I,
    950 
    951         pub fn init() Self {
    952             const initial = reflect(algorithm.initial);
    953             return .{ .crc = initial };
    954         }
    955 
    956         inline fn tableEntry(index: I) I {
    957             const short: u8 = @truncate(index);
    958             return lookup_table[short];
    959         }
    960 
    961         pub fn update(self: *Self, bytes: []const u8) void {
    962             var i: usize = 0;
    963             if (@bitSizeOf(I) <= 8) {
    964                 while (i < bytes.len) : (i += 1) {
    965                     self.crc = tableEntry(self.crc ^ bytes[i]);
    966                 }
    967             } else if (algorithm.reflect_input) {
    968                 while (i < bytes.len) : (i += 1) {
    969                     const table_index = self.crc ^ bytes[i];
    970                     self.crc = tableEntry(table_index) ^ (self.crc >> 8);
    971                 }
    972             } else {
    973                 while (i < bytes.len) : (i += 1) {
    974                     const table_index = (self.crc >> (@bitSizeOf(I) - 8)) ^ bytes[i];
    975                     self.crc = tableEntry(table_index) ^ (self.crc << 8);
    976                 }
    977             }
    978         }
    979 
    980         pub fn final(self: Self) W {
    981             var c = self.crc;
    982             if (algorithm.reflect_input != algorithm.reflect_output) {
    983                 c = @bitReverse(c);
    984             }
    985             if (!algorithm.reflect_output) {
    986                 c >>= @bitSizeOf(I) - @bitSizeOf(W);
    987             }
    988             return @intCast(c ^ algorithm.xor_output);
    989         }
    990 
    991         pub fn hash(bytes: []const u8) W {
    992             var c = Self.init();
    993             c.update(bytes);
    994             return c.final();
    995         }
    996 
    997         fn reflect(x: I) I {
    998             const offset = @bitSizeOf(I) - @bitSizeOf(W);
    999             if (algorithm.reflect_input)
   1000                 return @bitReverse(x) >> offset
   1001             else
   1002                 return x << offset;
   1003         }
   1004     };
   1005 }
   1006 
   1007 test {
   1008     _ = @import("crc/test.zig");
   1009 }