#[color=var(--color-prettylights-syntax-keyword)]include [color=var(--color-prettylights-syntax-string)]"crcLib.h" |
| |
| [color=var(--color-prettylights-syntax-comment)]/****************************************************************************** |
| [color=var(--color-prettylights-syntax-comment)] * Name: CRC-4/ITU x4+x+1 |
| [color=var(--color-prettylights-syntax-comment)] * Poly: 0x03 |
| [color=var(--color-prettylights-syntax-comment)] * Init: 0x00 |
| [color=var(--color-prettylights-syntax-comment)] * Refin: True |
| [color=var(--color-prettylights-syntax-comment)] * Refout: True |
| [color=var(--color-prettylights-syntax-comment)] * Xorout: 0x00 |
| [color=var(--color-prettylights-syntax-comment)] * Note: |
| [color=var(--color-prettylights-syntax-comment)] *****************************************************************************/ |
| [color=var(--color-prettylights-syntax-constant)]uint8_t [color=var(--color-prettylights-syntax-entity)]crc4_itu([color=var(--color-prettylights-syntax-constant)]uint8_t *data, [color=var(--color-prettylights-syntax-constant)]uint16_t length) |
| { |
| [color=var(--color-prettylights-syntax-constant)]uint8_t i; |
| [color=var(--color-prettylights-syntax-constant)]uint8_t crc = [color=var(--color-prettylights-syntax-constant)]0; [color=var(--color-prettylights-syntax-comment)]// Initial value |
| [color=var(--color-prettylights-syntax-keyword)]while(length--) |
| { |
| crc ^= *data++; [color=var(--color-prettylights-syntax-comment)]// crc ^= *data; data++; |
| [color=var(--color-prettylights-syntax-keyword)]for (i = [color=var(--color-prettylights-syntax-constant)]0; i < [color=var(--color-prettylights-syntax-constant)]8; ++i) |
| { |
| [color=var(--color-prettylights-syntax-keyword)]if (crc & [color=var(--color-prettylights-syntax-constant)]1) |
| crc = (crc >> [color=var(--color-prettylights-syntax-constant)]1) ^ [color=var(--color-prettylights-syntax-constant)]0x0C;[color=var(--color-prettylights-syntax-comment)]// 0x0C = (reverse 0x03)>>(8-4) |
| [color=var(--color-prettylights-syntax-keyword)]else |
| crc = (crc >> [color=var(--color-prettylights-syntax-constant)]1); |
| } |
| } |
| [color=var(--color-prettylights-syntax-keyword)]return crc; |
| } |
| |
| [color=var(--color-prettylights-syntax-comment)]/****************************************************************************** |
| [color=var(--color-prettylights-syntax-comment)] * Name: CRC-5/EPC x5+x3+1 |
| [color=var(--color-prettylights-syntax-comment)] * Poly: 0x09 |
| [color=var(--color-prettylights-syntax-comment)] * Init: 0x09 |
| [color=var(--color-prettylights-syntax-comment)] * Refin: False |
| [color=var(--color-prettylights-syntax-comment)] * Refout: False |
| [color=var(--color-prettylights-syntax-comment)] * Xorout: 0x00 |
| [color=var(--color-prettylights-syntax-comment)] * Note: |
| [color=var(--color-prettylights-syntax-comment)] *****************************************************************************/ |
| [color=var(--color-prettylights-syntax-constant)]uint8_t [color=var(--color-prettylights-syntax-entity)]crc5_epc([color=var(--color-prettylights-syntax-constant)]uint8_t *data, [color=var(--color-prettylights-syntax-constant)]uint16_t length) |
| { |
| [color=var(--color-prettylights-syntax-constant)]uint8_t i; |
| [color=var(--color-prettylights-syntax-constant)]uint8_t crc = [color=var(--color-prettylights-syntax-constant)]0x48; [color=var(--color-prettylights-syntax-comment)]// Initial value: 0x48 = 0x09<<(8-5) |
| [color=var(--color-prettylights-syntax-keyword)]while(length--) |
| { |
| crc ^= *data++; [color=var(--color-prettylights-syntax-comment)]// crc ^= *data; data++; |
| [color=var(--color-prettylights-syntax-keyword)]for ( i = [color=var(--color-prettylights-syntax-constant)]0; i < [color=var(--color-prettylights-syntax-constant)]8; i++ ) |
| { |
| [color=var(--color-prettylights-syntax-keyword)]if ( crc & [color=var(--color-prettylights-syntax-constant)]0x80 ) |
| crc = (crc << [color=var(--color-prettylights-syntax-constant)]1) ^ [color=var(--color-prettylights-syntax-constant)]0x48; [color=var(--color-prettylights-syntax-comment)]// 0x48 = 0x09<<(8-5) |
| [color=var(--color-prettylights-syntax-keyword)]else |
| crc <<= [color=var(--color-prettylights-syntax-constant)]1; |
| } |
| } |
| [color=var(--color-prettylights-syntax-keyword)]return crc >> [color=var(--color-prettylights-syntax-constant)]3; |
| } |
| |
| [color=var(--color-prettylights-syntax-comment)]/****************************************************************************** |
| [color=var(--color-prettylights-syntax-comment)] * Name: CRC-5/ITU x5+x4+x2+1 |
| [color=var(--color-prettylights-syntax-comment)] * Poly: 0x15 |
| [color=var(--color-prettylights-syntax-comment)] * Init: 0x00 |
| [color=var(--color-prettylights-syntax-comment)] * Refin: True |
| [color=var(--color-prettylights-syntax-comment)] * Refout: True |
| [color=var(--color-prettylights-syntax-comment)] * Xorout: 0x00 |
| [color=var(--color-prettylights-syntax-comment)] * Note: |
| [color=var(--color-prettylights-syntax-comment)] *****************************************************************************/ |
| [color=var(--color-prettylights-syntax-constant)]uint8_t [color=var(--color-prettylights-syntax-entity)]crc5_itu([color=var(--color-prettylights-syntax-constant)]uint8_t *data, [color=var(--color-prettylights-syntax-constant)]uint16_t length) |
| { |
| [color=var(--color-prettylights-syntax-constant)]uint8_t i; |
| [color=var(--color-prettylights-syntax-constant)]uint8_t crc = [color=var(--color-prettylights-syntax-constant)]0; [color=var(--color-prettylights-syntax-comment)]// Initial value |
| [color=var(--color-prettylights-syntax-keyword)]while(length--) |
| { |
| crc ^= *data++; [color=var(--color-prettylights-syntax-comment)]// crc ^= *data; data++; |
| [color=var(--color-prettylights-syntax-keyword)]for (i = [color=var(--color-prettylights-syntax-constant)]0; i < [color=var(--color-prettylights-syntax-constant)]8; ++i) |
| { |
| [color=var(--color-prettylights-syntax-keyword)]if (crc & [color=var(--color-prettylights-syntax-constant)]1) |
| crc = (crc >> [color=var(--color-prettylights-syntax-constant)]1) ^ [color=var(--color-prettylights-syntax-constant)]0x15;[color=var(--color-prettylights-syntax-comment)]// 0x15 = (reverse 0x15)>>(8-5) |
| [color=var(--color-prettylights-syntax-keyword)]else |
| crc = (crc >> [color=var(--color-prettylights-syntax-constant)]1); |
| } |
| } |
| [color=var(--color-prettylights-syntax-keyword)]return crc; |
| } |
| |
| [color=var(--color-prettylights-syntax-comment)]/****************************************************************************** |
| [color=var(--color-prettylights-syntax-comment)] * Name: CRC-5/USB x5+x2+1 |
| [color=var(--color-prettylights-syntax-comment)] * Poly: 0x05 |
| [color=var(--color-prettylights-syntax-comment)] * Init: 0x1F |
| [color=var(--color-prettylights-syntax-comment)] * Refin: True |
| [color=var(--color-prettylights-syntax-comment)] * Refout: True |
| [color=var(--color-prettylights-syntax-comment)] * Xorout: 0x1F |
| [color=var(--color-prettylights-syntax-comment)] * Note: |
| [color=var(--color-prettylights-syntax-comment)] *****************************************************************************/ |
| [color=var(--color-prettylights-syntax-constant)]uint8_t [color=var(--color-prettylights-syntax-entity)]crc5_usb([color=var(--color-prettylights-syntax-constant)]uint8_t *data, [color=var(--color-prettylights-syntax-constant)]uint16_t length) |
| { |
| [color=var(--color-prettylights-syntax-constant)]uint8_t i; |
| [color=var(--color-prettylights-syntax-constant)]uint8_t crc = [color=var(--color-prettylights-syntax-constant)]0x1F; [color=var(--color-prettylights-syntax-comment)]// Initial value |
| [color=var(--color-prettylights-syntax-keyword)]while(length--) |
| { |
| crc ^= *data++; [color=var(--color-prettylights-syntax-comment)]// crc ^= *data; data++; |
| [color=var(--color-prettylights-syntax-keyword)]for (i = [color=var(--color-prettylights-syntax-constant)]0; i < [color=var(--color-prettylights-syntax-constant)]8; ++i) |
| { |
| [color=var(--color-prettylights-syntax-keyword)]if (crc & [color=var(--color-prettylights-syntax-constant)]1) |
| crc = (crc >> [color=var(--color-prettylights-syntax-constant)]1) ^ [color=var(--color-prettylights-syntax-constant)]0x14;[color=var(--color-prettylights-syntax-comment)]// 0x14 = (reverse 0x05)>>(8-5) |
| [color=var(--color-prettylights-syntax-keyword)]else |
| crc = (crc >> [color=var(--color-prettylights-syntax-constant)]1); |
| } |
| } |
| [color=var(--color-prettylights-syntax-keyword)]return crc ^ [color=var(--color-prettylights-syntax-constant)]0x1F; |
| } |
| |
| [color=var(--color-prettylights-syntax-comment)]/****************************************************************************** |
| [color=var(--color-prettylights-syntax-comment)] * Name: CRC-6/ITU x6+x+1 |
| [color=var(--color-prettylights-syntax-comment)] * Poly: 0x03 |
| [color=var(--color-prettylights-syntax-comment)] * Init: 0x00 |
| [color=var(--color-prettylights-syntax-comment)] * Refin: True |
| [color=var(--color-prettylights-syntax-comment)] * Refout: True |
| [color=var(--color-prettylights-syntax-comment)] * Xorout: 0x00 |
| [color=var(--color-prettylights-syntax-comment)] * Note: |
| [color=var(--color-prettylights-syntax-comment)] *****************************************************************************/ |
| [color=var(--color-prettylights-syntax-constant)]uint8_t [color=var(--color-prettylights-syntax-entity)]crc6_itu([color=var(--color-prettylights-syntax-constant)]uint8_t *data, [color=var(--color-prettylights-syntax-constant)]uint16_t length) |
| { |
| [color=var(--color-prettylights-syntax-constant)]uint8_t i; |
| [color=var(--color-prettylights-syntax-constant)]uint8_t crc = [color=var(--color-prettylights-syntax-constant)]0; [color=var(--color-prettylights-syntax-comment)]// Initial value |
| [color=var(--color-prettylights-syntax-keyword)]while(length--) |
| { |
| crc ^= *data++; [color=var(--color-prettylights-syntax-comment)]// crc ^= *data; data++; |
| [color=var(--color-prettylights-syntax-keyword)]for (i = [color=var(--color-prettylights-syntax-constant)]0; i < [color=var(--color-prettylights-syntax-constant)]8; ++i) |
| { |
| [color=var(--color-prettylights-syntax-keyword)]if (crc & [color=var(--color-prettylights-syntax-constant)]1) |
| crc = (crc >> [color=var(--color-prettylights-syntax-constant)]1) ^ [color=var(--color-prettylights-syntax-constant)]0x30;[color=var(--color-prettylights-syntax-comment)]// 0x30 = (reverse 0x03)>>(8-6) |
| [color=var(--color-prettylights-syntax-keyword)]else |
| crc = (crc >> [color=var(--color-prettylights-syntax-constant)]1); |
| } |
| } |
| [color=var(--color-prettylights-syntax-keyword)]return crc; |
| } |
| |
| [color=var(--color-prettylights-syntax-comment)]/****************************************************************************** |
| [color=var(--color-prettylights-syntax-comment)] * Name: CRC-7/MMC x7+x3+1 |
| [color=var(--color-prettylights-syntax-comment)] * Poly: 0x09 |
| [color=var(--color-prettylights-syntax-comment)] * Init: 0x00 |
| [color=var(--color-prettylights-syntax-comment)] * Refin: False |
| [color=var(--color-prettylights-syntax-comment)] * Refout: False |
| [color=var(--color-prettylights-syntax-comment)] * Xorout: 0x00 |
| [color=var(--color-prettylights-syntax-comment)] * Use: MultiMediaCard,SD,ect. |
| [color=var(--color-prettylights-syntax-comment)] *****************************************************************************/ |
| [color=var(--color-prettylights-syntax-constant)]uint8_t [color=var(--color-prettylights-syntax-entity)]crc7_mmc([color=var(--color-prettylights-syntax-constant)]uint8_t *data, [color=var(--color-prettylights-syntax-constant)]uint16_t length) |
| { |
| [color=var(--color-prettylights-syntax-constant)]uint8_t i; |
| [color=var(--color-prettylights-syntax-constant)]uint8_t crc = [color=var(--color-prettylights-syntax-constant)]0; [color=var(--color-prettylights-syntax-comment)]// Initial value |
| [color=var(--color-prettylights-syntax-keyword)]while(length--) |
| { |
| crc ^= *data++; [color=var(--color-prettylights-syntax-comment)]// crc ^= *data; data++; |
| [color=var(--color-prettylights-syntax-keyword)]for ( i = [color=var(--color-prettylights-syntax-constant)]0; i < [color=var(--color-prettylights-syntax-constant)]8; i++ ) |
| { |
| [color=var(--color-prettylights-syntax-keyword)]if ( crc & [color=var(--color-prettylights-syntax-constant)]0x80 ) |
| crc = (crc << [color=var(--color-prettylights-syntax-constant)]1) ^ [color=var(--color-prettylights-syntax-constant)]0x12; [color=var(--color-prettylights-syntax-comment)]// 0x12 = 0x09<<(8-7) |
| [color=var(--color-prettylights-syntax-keyword)]else |
| crc <<= [color=var(--color-prettylights-syntax-constant)]1; |
| } |
| } |
| [color=var(--color-prettylights-syntax-keyword)]return crc >> [color=var(--color-prettylights-syntax-constant)]1; |
| } |
| |
| [color=var(--color-prettylights-syntax-comment)]/****************************************************************************** |
| [color=var(--color-prettylights-syntax-comment)] * Name: CRC-8 x8+x2+x+1 |
| [color=var(--color-prettylights-syntax-comment)] * Poly: 0x07 |
| [color=var(--color-prettylights-syntax-comment)] * Init: 0x00 |
| [color=var(--color-prettylights-syntax-comment)] * Refin: False |
| [color=var(--color-prettylights-syntax-comment)] * Refout: False |
| [color=var(--color-prettylights-syntax-comment)] * Xorout: 0x00 |
| [color=var(--color-prettylights-syntax-comment)] * Note: |
| [color=var(--color-prettylights-syntax-comment)] *****************************************************************************/ |
| [color=var(--color-prettylights-syntax-constant)]uint8_t [color=var(--color-prettylights-syntax-entity)]crc8([color=var(--color-prettylights-syntax-constant)]uint8_t *data, [color=var(--color-prettylights-syntax-constant)]uint16_t length) |
| { |
| [color=var(--color-prettylights-syntax-constant)]uint8_t i; |
| [color=var(--color-prettylights-syntax-constant)]uint8_t crc = [color=var(--color-prettylights-syntax-constant)]0; [color=var(--color-prettylights-syntax-comment)]// Initial value |
| [color=var(--color-prettylights-syntax-keyword)]while(length--) |
| { |
| crc ^= *data++; [color=var(--color-prettylights-syntax-comment)]// crc ^= *data; data++; |
| [color=var(--color-prettylights-syntax-keyword)]for ( i = [color=var(--color-prettylights-syntax-constant)]0; i < [color=var(--color-prettylights-syntax-constant)]8; i++ ) |
| { |
| [color=var(--color-prettylights-syntax-keyword)]if ( crc & [color=var(--color-prettylights-syntax-constant)]0x80 ) |
| crc = (crc << [color=var(--color-prettylights-syntax-constant)]1) ^ [color=var(--color-prettylights-syntax-constant)]0x07; |
| [color=var(--color-prettylights-syntax-keyword)]else |
| crc <<= [color=var(--color-prettylights-syntax-constant)]1; |
| } |
| } |
| [color=var(--color-prettylights-syntax-keyword)]return crc; |
| } |
| |
| [color=var(--color-prettylights-syntax-comment)]/****************************************************************************** |
| [color=var(--color-prettylights-syntax-comment)] * Name: CRC-8/ITU x8+x2+x+1 |
| [color=var(--color-prettylights-syntax-comment)] * Poly: 0x07 |
| [color=var(--color-prettylights-syntax-comment)] * Init: 0x00 |
| [color=var(--color-prettylights-syntax-comment)] * Refin: False |
| [color=var(--color-prettylights-syntax-comment)] * Refout: False |
| [color=var(--color-prettylights-syntax-comment)] * Xorout: 0x55 |
| [color=var(--color-prettylights-syntax-comment)] * Alias: CRC-8/ATM |
| [color=var(--color-prettylights-syntax-comment)] *****************************************************************************/ |
| [color=var(--color-prettylights-syntax-constant)]uint8_t [color=var(--color-prettylights-syntax-entity)]crc8_itu([color=var(--color-prettylights-syntax-constant)]uint8_t *data, [color=var(--color-prettylights-syntax-constant)]uint16_t length) |
| { |
| [color=var(--color-prettylights-syntax-constant)]uint8_t i; |
| [color=var(--color-prettylights-syntax-constant)]uint8_t crc = [color=var(--color-prettylights-syntax-constant)]0; [color=var(--color-prettylights-syntax-comment)]// Initial value |
| [color=var(--color-prettylights-syntax-keyword)]while(length--) |
| { |
| crc ^= *data++; [color=var(--color-prettylights-syntax-comment)]// crc ^= *data; data++; |
| [color=var(--color-prettylights-syntax-keyword)]for ( i = [color=var(--color-prettylights-syntax-constant)]0; i < [color=var(--color-prettylights-syntax-constant)]8; i++ ) |
| { |
| [color=var(--color-prettylights-syntax-keyword)]if ( crc & [color=var(--color-prettylights-syntax-constant)]0x80 ) |
| crc = (crc << [color=var(--color-prettylights-syntax-constant)]1) ^ [color=var(--color-prettylights-syntax-constant)]0x07; |
| [color=var(--color-prettylights-syntax-keyword)]else |
| crc <<= [color=var(--color-prettylights-syntax-constant)]1; |
| } |
| } |
| [color=var(--color-prettylights-syntax-keyword)]return crc ^ [color=var(--color-prettylights-syntax-constant)]0x55; |
| } |
| |
| [color=var(--color-prettylights-syntax-comment)]/****************************************************************************** |
| [color=var(--color-prettylights-syntax-comment)] * Name: CRC-8/ROHC x8+x2+x+1 |
| [color=var(--color-prettylights-syntax-comment)] * Poly: 0x07 |
| [color=var(--color-prettylights-syntax-comment)] * Init: 0xFF |
| [color=var(--color-prettylights-syntax-comment)] * Refin: True |
| [color=var(--color-prettylights-syntax-comment)] * Refout: True |
| [color=var(--color-prettylights-syntax-comment)] * Xorout: 0x00 |
| [color=var(--color-prettylights-syntax-comment)] * Note: |
| [color=var(--color-prettylights-syntax-comment)] *****************************************************************************/ |
| [color=var(--color-prettylights-syntax-constant)]uint8_t [color=var(--color-prettylights-syntax-entity)]crc8_rohc([color=var(--color-prettylights-syntax-constant)]uint8_t *data, [color=var(--color-prettylights-syntax-constant)]uint16_t length) |
| { |
| [color=var(--color-prettylights-syntax-constant)]uint8_t i; |
| [color=var(--color-prettylights-syntax-constant)]uint8_t crc = [color=var(--color-prettylights-syntax-constant)]0xFF; [color=var(--color-prettylights-syntax-comment)]// Initial value |
| [color=var(--color-prettylights-syntax-keyword)]while(length--) |
| { |
| crc ^= *data++; [color=var(--color-prettylights-syntax-comment)]// crc ^= *data; data++; |
| [color=var(--color-prettylights-syntax-keyword)]for (i = [color=var(--color-prettylights-syntax-constant)]0; i < [color=var(--color-prettylights-syntax-constant)]8; ++i) |
| { |
| [color=var(--color-prettylights-syntax-keyword)]if (crc & [color=var(--color-prettylights-syntax-constant)]1) |
| crc = (crc >> [color=var(--color-prettylights-syntax-constant)]1) ^ [color=var(--color-prettylights-syntax-constant)]0xE0; [color=var(--color-prettylights-syntax-comment)]// 0xE0 = reverse 0x07 |
| [color=var(--color-prettylights-syntax-keyword)]else |
| crc = (crc >> [color=var(--color-prettylights-syntax-constant)]1); |
| } |
| } |
| [color=var(--color-prettylights-syntax-keyword)]return crc; |
| } |
| |
| [color=var(--color-prettylights-syntax-comment)]/****************************************************************************** |
| [color=var(--color-prettylights-syntax-comment)] * Name: CRC-8/MAXIM x8+x5+x4+1 |
| [color=var(--color-prettylights-syntax-comment)] * Poly: 0x31 |
| [color=var(--color-prettylights-syntax-comment)] * Init: 0x00 |
| [color=var(--color-prettylights-syntax-comment)] * Refin: True |
| [color=var(--color-prettylights-syntax-comment)] * Refout: True |
| [color=var(--color-prettylights-syntax-comment)] * Xorout: 0x00 |
| [color=var(--color-prettylights-syntax-comment)] * Alias: DOW-CRC,CRC-8/IBUTTON |
| [color=var(--color-prettylights-syntax-comment)] * Use: Maxim(Dallas)'s some devices,e.g. DS18B20 |
| [color=var(--color-prettylights-syntax-comment)] *****************************************************************************/ |
| [color=var(--color-prettylights-syntax-constant)]uint8_t [color=var(--color-prettylights-syntax-entity)]crc8_maxim([color=var(--color-prettylights-syntax-constant)]uint8_t *data, [color=var(--color-prettylights-syntax-constant)]uint16_t length) |
| { |
| [color=var(--color-prettylights-syntax-constant)]uint8_t i; |
| [color=var(--color-prettylights-syntax-constant)]uint8_t crc = [color=var(--color-prettylights-syntax-constant)]0; [color=var(--color-prettylights-syntax-comment)]// Initial value |
| [color=var(--color-prettylights-syntax-keyword)]while(length--) |
| { |
| crc ^= *data++; [color=var(--color-prettylights-syntax-comment)]// crc ^= *data; data++; |
| [color=var(--color-prettylights-syntax-keyword)]for (i = [color=var(--color-prettylights-syntax-constant)]0; i < [color=var(--color-prettylights-syntax-constant)]8; i++) |
| { |
| [color=var(--color-prettylights-syntax-keyword)]if (crc & [color=var(--color-prettylights-syntax-constant)]1) |
| crc = (crc >> [color=var(--color-prettylights-syntax-constant)]1) ^ [color=var(--color-prettylights-syntax-constant)]0x8C; [color=var(--color-prettylights-syntax-comment)]// 0x8C = reverse 0x31 |
| [color=var(--color-prettylights-syntax-keyword)]else |
| crc >>= [color=var(--color-prettylights-syntax-constant)]1; |
| } |
| } |
| [color=var(--color-prettylights-syntax-keyword)]return crc; |
| } |
| |
| [color=var(--color-prettylights-syntax-comment)]/****************************************************************************** |
| [color=var(--color-prettylights-syntax-comment)] * Name: CRC-16/IBM x16+x15+x2+1 |
| [color=var(--color-prettylights-syntax-comment)] * Poly: 0x8005 |
| [color=var(--color-prettylights-syntax-comment)] * Init: 0x0000 |
| [color=var(--color-prettylights-syntax-comment)] * Refin: True |
| [color=var(--color-prettylights-syntax-comment)] * Refout: True |
| [color=var(--color-prettylights-syntax-comment)] * Xorout: 0x0000 |
| [color=var(--color-prettylights-syntax-comment)] * Alias: CRC-16,CRC-16/ARC,CRC-16/LHA |
| [color=var(--color-prettylights-syntax-comment)] *****************************************************************************/ |
| [color=var(--color-prettylights-syntax-constant)]uint16_t [color=var(--color-prettylights-syntax-entity)]crc16_ibm([color=var(--color-prettylights-syntax-constant)]uint8_t *data, [color=var(--color-prettylights-syntax-constant)]uint16_t length) |
| { |
| [color=var(--color-prettylights-syntax-constant)]uint8_t i; |
| [color=var(--color-prettylights-syntax-constant)]uint16_t crc = [color=var(--color-prettylights-syntax-constant)]0; [color=var(--color-prettylights-syntax-comment)]// Initial value |
| [color=var(--color-prettylights-syntax-keyword)]while(length--) |
| { |
| crc ^= *data++; [color=var(--color-prettylights-syntax-comment)]// crc ^= *data; data++; |
| [color=var(--color-prettylights-syntax-keyword)]for (i = [color=var(--color-prettylights-syntax-constant)]0; i < [color=var(--color-prettylights-syntax-constant)]8; ++i) |
| { |
| [color=var(--color-prettylights-syntax-keyword)]if (crc & [color=var(--color-prettylights-syntax-constant)]1) |
| crc = (crc >> [color=var(--color-prettylights-syntax-constant)]1) ^ [color=var(--color-prettylights-syntax-constant)]0xA001; [color=var(--color-prettylights-syntax-comment)]// 0xA001 = reverse 0x8005 |
| [color=var(--color-prettylights-syntax-keyword)]else |
| crc = (crc >> [color=var(--color-prettylights-syntax-constant)]1); |
| } |
| } |
| [color=var(--color-prettylights-syntax-keyword)]return crc; |
| } |
| |
| [color=var(--color-prettylights-syntax-comment)]/****************************************************************************** |
| [color=var(--color-prettylights-syntax-comment)] * Name: CRC-16/MAXIM x16+x15+x2+1 |
| [color=var(--color-prettylights-syntax-comment)] * Poly: 0x8005 |
| [color=var(--color-prettylights-syntax-comment)] * Init: 0x0000 |
| [color=var(--color-prettylights-syntax-comment)] * Refin: True |
| [color=var(--color-prettylights-syntax-comment)] * Refout: True |
| [color=var(--color-prettylights-syntax-comment)] * Xorout: 0xFFFF |
| [color=var(--color-prettylights-syntax-comment)] * Note: |
| [color=var(--color-prettylights-syntax-comment)] *****************************************************************************/ |
| [color=var(--color-prettylights-syntax-constant)]uint16_t [color=var(--color-prettylights-syntax-entity)]crc16_maxim([color=var(--color-prettylights-syntax-constant)]uint8_t *data, [color=var(--color-prettylights-syntax-constant)]uint16_t length) |
| { |
| [color=var(--color-prettylights-syntax-constant)]uint8_t i; |
| [color=var(--color-prettylights-syntax-constant)]uint16_t crc = [color=var(--color-prettylights-syntax-constant)]0; [color=var(--color-prettylights-syntax-comment)]// Initial value |
| [color=var(--color-prettylights-syntax-keyword)]while(length--) |
| { |
| crc ^= *data++; [color=var(--color-prettylights-syntax-comment)]// crc ^= *data; data++; |
| [color=var(--color-prettylights-syntax-keyword)]for (i = [color=var(--color-prettylights-syntax-constant)]0; i < [color=var(--color-prettylights-syntax-constant)]8; ++i) |
| { |
| [color=var(--color-prettylights-syntax-keyword)]if (crc & [color=var(--color-prettylights-syntax-constant)]1) |
| crc = (crc >> [color=var(--color-prettylights-syntax-constant)]1) ^ [color=var(--color-prettylights-syntax-constant)]0xA001; [color=var(--color-prettylights-syntax-comment)]// 0xA001 = reverse 0x8005 |
| [color=var(--color-prettylights-syntax-keyword)]else |
| crc = (crc >> [color=var(--color-prettylights-syntax-constant)]1); |
| } |
| } |
| [color=var(--color-prettylights-syntax-keyword)]return ~crc; [color=var(--color-prettylights-syntax-comment)]// crc^0xffff |
| } |
| |
| [color=var(--color-prettylights-syntax-comment)]/****************************************************************************** |
| [color=var(--color-prettylights-syntax-comment)] * Name: CRC-16/USB x16+x15+x2+1 |
| [color=var(--color-prettylights-syntax-comment)] * Poly: 0x8005 |
| [color=var(--color-prettylights-syntax-comment)] * Init: 0xFFFF |
| [color=var(--color-prettylights-syntax-comment)] * Refin: True |
| [color=var(--color-prettylights-syntax-comment)] * Refout: True |
| [color=var(--color-prettylights-syntax-comment)] * Xorout: 0xFFFF |
| [color=var(--color-prettylights-syntax-comment)] * Note: |
| [color=var(--color-prettylights-syntax-comment)] *****************************************************************************/ |
| [color=var(--color-prettylights-syntax-constant)]uint16_t [color=var(--color-prettylights-syntax-entity)]crc16_usb([color=var(--color-prettylights-syntax-constant)]uint8_t *data, [color=var(--color-prettylights-syntax-constant)]uint16_t length) |
| { |
| [color=var(--color-prettylights-syntax-constant)]uint8_t i; |
| [color=var(--color-prettylights-syntax-constant)]uint16_t crc = [color=var(--color-prettylights-syntax-constant)]0xffff; [color=var(--color-prettylights-syntax-comment)]// Initial value |
| [color=var(--color-prettylights-syntax-keyword)]while(length--) |
| { |
| crc ^= *data++; [color=var(--color-prettylights-syntax-comment)]// crc ^= *data; data++; |
| [color=var(--color-prettylights-syntax-keyword)]for (i = [color=var(--color-prettylights-syntax-constant)]0; i < [color=var(--color-prettylights-syntax-constant)]8; ++i) |
| { |
| [color=var(--color-prettylights-syntax-keyword)]if (crc & [color=var(--color-prettylights-syntax-constant)]1) |
| crc = (crc >> [color=var(--color-prettylights-syntax-constant)]1) ^ [color=var(--color-prettylights-syntax-constant)]0xA001; [color=var(--color-prettylights-syntax-comment)]// 0xA001 = reverse 0x8005 |
| [color=var(--color-prettylights-syntax-keyword)]else |
| crc = (crc >> [color=var(--color-prettylights-syntax-constant)]1); |
| } |
| } |
| [color=var(--color-prettylights-syntax-keyword)]return ~crc; [color=var(--color-prettylights-syntax-comment)]// crc^0xffff |
| } |
| |
| [color=var(--color-prettylights-syntax-comment)]/****************************************************************************** |
| [color=var(--color-prettylights-syntax-comment)] * Name: CRC-16/MODBUS x16+x15+x2+1 |
| [color=var(--color-prettylights-syntax-comment)] * Poly: 0x8005 |
| [color=var(--color-prettylights-syntax-comment)] * Init: 0xFFFF |
| [color=var(--color-prettylights-syntax-comment)] * Refin: True |
| [color=var(--color-prettylights-syntax-comment)] * Refout: True |
| [color=var(--color-prettylights-syntax-comment)] * Xorout: 0x0000 |
| [color=var(--color-prettylights-syntax-comment)] * Note: |
| [color=var(--color-prettylights-syntax-comment)] *****************************************************************************/ |
| [color=var(--color-prettylights-syntax-constant)]uint16_t [color=var(--color-prettylights-syntax-entity)]crc16_modbus([color=var(--color-prettylights-syntax-constant)]uint8_t *data, [color=var(--color-prettylights-syntax-constant)]uint16_t length) |
| { |
| [color=var(--color-prettylights-syntax-constant)]uint8_t i; |
| [color=var(--color-prettylights-syntax-constant)]uint16_t crc = [color=var(--color-prettylights-syntax-constant)]0xffff; [color=var(--color-prettylights-syntax-comment)]// Initial value |
| [color=var(--color-prettylights-syntax-keyword)]while(length--) |
| { |
| crc ^= *data++; [color=var(--color-prettylights-syntax-comment)]// crc ^= *data; data++; |
| [color=var(--color-prettylights-syntax-keyword)]for (i = [color=var(--color-prettylights-syntax-constant)]0; i < [color=var(--color-prettylights-syntax-constant)]8; ++i) |
| { |
| [color=var(--color-prettylights-syntax-keyword)]if (crc & [color=var(--color-prettylights-syntax-constant)]1) |
| crc = (crc >> [color=var(--color-prettylights-syntax-constant)]1) ^ [color=var(--color-prettylights-syntax-constant)]0xA001; [color=var(--color-prettylights-syntax-comment)]// 0xA001 = reverse 0x8005 |
| [color=var(--color-prettylights-syntax-keyword)]else |
| crc = (crc >> [color=var(--color-prettylights-syntax-constant)]1); |
| } |
| } |
| [color=var(--color-prettylights-syntax-keyword)]return crc; |
| } |
| |
| [color=var(--color-prettylights-syntax-comment)]/****************************************************************************** |
| [color=var(--color-prettylights-syntax-comment)] * Name: CRC-16/CCITT x16+x12+x5+1 |
| [color=var(--color-prettylights-syntax-comment)] * Poly: 0x1021 |
| [color=var(--color-prettylights-syntax-comment)] * Init: 0x0000 |
| [color=var(--color-prettylights-syntax-comment)] * Refin: True |
| [color=var(--color-prettylights-syntax-comment)] * Refout: True |
| [color=var(--color-prettylights-syntax-comment)] * Xorout: 0x0000 |
| [color=var(--color-prettylights-syntax-comment)] * Alias: CRC-CCITT,CRC-16/CCITT-TRUE,CRC-16/KERMIT |
| [color=var(--color-prettylights-syntax-comment)] *****************************************************************************/ |
| [color=var(--color-prettylights-syntax-constant)]uint16_t [color=var(--color-prettylights-syntax-entity)]crc16_ccitt([color=var(--color-prettylights-syntax-constant)]uint8_t *data, [color=var(--color-prettylights-syntax-constant)]uint16_t length) |
| { |
| [color=var(--color-prettylights-syntax-constant)]uint8_t i; |
| [color=var(--color-prettylights-syntax-constant)]uint16_t crc = [color=var(--color-prettylights-syntax-constant)]0; [color=var(--color-prettylights-syntax-comment)]// Initial value |
| [color=var(--color-prettylights-syntax-keyword)]while(length--) |
| { |
| crc ^= *data++; [color=var(--color-prettylights-syntax-comment)]// crc ^= *data; data++; |
| [color=var(--color-prettylights-syntax-keyword)]for (i = [color=var(--color-prettylights-syntax-constant)]0; i < [color=var(--color-prettylights-syntax-constant)]8; ++i) |
| { |
| [color=var(--color-prettylights-syntax-keyword)]if (crc & [color=var(--color-prettylights-syntax-constant)]1) |
| crc = (crc >> [color=var(--color-prettylights-syntax-constant)]1) ^ [color=var(--color-prettylights-syntax-constant)]0x8408; [color=var(--color-prettylights-syntax-comment)]// 0x8408 = reverse 0x1021 |
| [color=var(--color-prettylights-syntax-keyword)]else |
| crc = (crc >> [color=var(--color-prettylights-syntax-constant)]1); |
| } |
| } |
| [color=var(--color-prettylights-syntax-keyword)]return crc; |
| } |
| |
| [color=var(--color-prettylights-syntax-comment)]/****************************************************************************** |
| [color=var(--color-prettylights-syntax-comment)] * Name: CRC-16/CCITT-FALSE x16+x12+x5+1 |
| [color=var(--color-prettylights-syntax-comment)] * Poly: 0x1021 |
| [color=var(--color-prettylights-syntax-comment)] * Init: 0xFFFF |
| [color=var(--color-prettylights-syntax-comment)] * Refin: False |
| [color=var(--color-prettylights-syntax-comment)] * Refout: False |
| [color=var(--color-prettylights-syntax-comment)] * Xorout: 0x0000 |
| [color=var(--color-prettylights-syntax-comment)] * Note: |
| [color=var(--color-prettylights-syntax-comment)] *****************************************************************************/ |
| [color=var(--color-prettylights-syntax-constant)]uint16_t [color=var(--color-prettylights-syntax-entity)]crc16_ccitt_false([color=var(--color-prettylights-syntax-constant)]uint8_t *data, [color=var(--color-prettylights-syntax-constant)]uint16_t length) |
| { |
| [color=var(--color-prettylights-syntax-constant)]uint8_t i; |
| [color=var(--color-prettylights-syntax-constant)]uint16_t crc = [color=var(--color-prettylights-syntax-constant)]0xffff; [color=var(--color-prettylights-syntax-comment)]//Initial value |
| [color=var(--color-prettylights-syntax-keyword)]while(length--) |
| { |
| crc ^= ([color=var(--color-prettylights-syntax-constant)]uint16_t)(*data++) << [color=var(--color-prettylights-syntax-constant)]8; [color=var(--color-prettylights-syntax-comment)]// crc ^= (uint6_t)(*data)<<8; data++; |
| [color=var(--color-prettylights-syntax-keyword)]for (i = [color=var(--color-prettylights-syntax-constant)]0; i < [color=var(--color-prettylights-syntax-constant)]8; ++i) |
| { |
| [color=var(--color-prettylights-syntax-keyword)]if ( crc & [color=var(--color-prettylights-syntax-constant)]0x8000 ) |
| crc = (crc << [color=var(--color-prettylights-syntax-constant)]1) ^ [color=var(--color-prettylights-syntax-constant)]0x1021; |
| [color=var(--color-prettylights-syntax-keyword)]else |
| crc <<= [color=var(--color-prettylights-syntax-constant)]1; |
| } |
| } |
| [color=var(--color-prettylights-syntax-keyword)]return crc; |
| } |
| |
| [color=var(--color-prettylights-syntax-comment)]/****************************************************************************** |
| [color=var(--color-prettylights-syntax-comment)] * Name: CRC-16/X25 x16+x12+x5+1 |
| [color=var(--color-prettylights-syntax-comment)] * Poly: 0x1021 |
| [color=var(--color-prettylights-syntax-comment)] * Init: 0xFFFF |
| [color=var(--color-prettylights-syntax-comment)] * Refin: True |
| [color=var(--color-prettylights-syntax-comment)] * Refout: True |
| [color=var(--color-prettylights-syntax-comment)] * Xorout: 0XFFFF |
| [color=var(--color-prettylights-syntax-comment)] * Note: |
| [color=var(--color-prettylights-syntax-comment)] *****************************************************************************/ |
| [color=var(--color-prettylights-syntax-constant)]uint16_t [color=var(--color-prettylights-syntax-entity)]crc16_x25([color=var(--color-prettylights-syntax-constant)]uint8_t *data, [color=var(--color-prettylights-syntax-constant)]uint16_t length) |
| { |
| [color=var(--color-prettylights-syntax-constant)]uint8_t i; |
| [color=var(--color-prettylights-syntax-constant)]uint16_t crc = [color=var(--color-prettylights-syntax-constant)]0xffff; [color=var(--color-prettylights-syntax-comment)]// Initial value |
| [color=var(--color-prettylights-syntax-keyword)]while(length--) |
| { |
| crc ^= *data++; [color=var(--color-prettylights-syntax-comment)]// crc ^= *data; data++; |
| [color=var(--color-prettylights-syntax-keyword)]for (i = [color=var(--color-prettylights-syntax-constant)]0; i < [color=var(--color-prettylights-syntax-constant)]8; ++i) |
| { |
| [color=var(--color-prettylights-syntax-keyword)]if (crc & [color=var(--color-prettylights-syntax-constant)]1) |
| crc = (crc >> [color=var(--color-prettylights-syntax-constant)]1) ^ [color=var(--color-prettylights-syntax-constant)]0x8408; [color=var(--color-prettylights-syntax-comment)]// 0x8408 = reverse 0x1021 |
| [color=var(--color-prettylights-syntax-keyword)]else |
| crc = (crc >> [color=var(--color-prettylights-syntax-constant)]1); |
| } |
| } |
| [color=var(--color-prettylights-syntax-keyword)]return ~crc; [color=var(--color-prettylights-syntax-comment)]// crc^Xorout |
| } |
| |
| [color=var(--color-prettylights-syntax-comment)]/****************************************************************************** |
| [color=var(--color-prettylights-syntax-comment)] * Name: CRC-16/XMODEM x16+x12+x5+1 |
| [color=var(--color-prettylights-syntax-comment)] * Poly: 0x1021 |
| [color=var(--color-prettylights-syntax-comment)] * Init: 0x0000 |
| [color=var(--color-prettylights-syntax-comment)] * Refin: False |
| [color=var(--color-prettylights-syntax-comment)] * Refout: False |
| [color=var(--color-prettylights-syntax-comment)] * Xorout: 0x0000 |
| [color=var(--color-prettylights-syntax-comment)] * Alias: CRC-16/ZMODEM,CRC-16/ACORN |
| [color=var(--color-prettylights-syntax-comment)] *****************************************************************************/ |
| [color=var(--color-prettylights-syntax-constant)]uint16_t [color=var(--color-prettylights-syntax-entity)]crc16_xmodem([color=var(--color-prettylights-syntax-constant)]uint8_t *data, [color=var(--color-prettylights-syntax-constant)]uint16_t length) |
| { |
| [color=var(--color-prettylights-syntax-constant)]uint8_t i; |
| [color=var(--color-prettylights-syntax-constant)]uint16_t crc = [color=var(--color-prettylights-syntax-constant)]0; [color=var(--color-prettylights-syntax-comment)]// Initial value |
| [color=var(--color-prettylights-syntax-keyword)]while(length--) |
| { |
| crc ^= ([color=var(--color-prettylights-syntax-constant)]uint16_t)(*data++) << [color=var(--color-prettylights-syntax-constant)]8; [color=var(--color-prettylights-syntax-comment)]// crc ^= (uint16_t)(*data)<<8; data++; |
| [color=var(--color-prettylights-syntax-keyword)]for (i = [color=var(--color-prettylights-syntax-constant)]0; i < [color=var(--color-prettylights-syntax-constant)]8; ++i) |
| { |
| [color=var(--color-prettylights-syntax-keyword)]if ( crc & [color=var(--color-prettylights-syntax-constant)]0x8000 ) |
| crc = (crc << [color=var(--color-prettylights-syntax-constant)]1) ^ [color=var(--color-prettylights-syntax-constant)]0x1021; |
| [color=var(--color-prettylights-syntax-keyword)]else |
| crc <<= [color=var(--color-prettylights-syntax-constant)]1; |
| } |
| } |
| [color=var(--color-prettylights-syntax-keyword)]return crc; |
| } |
| |
| [color=var(--color-prettylights-syntax-comment)]/****************************************************************************** |
| [color=var(--color-prettylights-syntax-comment)] * Name: CRC-16/DNP x16+x13+x12+x11+x10+x8+x6+x5+x2+1 |
| [color=var(--color-prettylights-syntax-comment)] * Poly: 0x3D65 |
| [color=var(--color-prettylights-syntax-comment)] * Init: 0x0000 |
| [color=var(--color-prettylights-syntax-comment)] * Refin: True |
| [color=var(--color-prettylights-syntax-comment)] * Refout: True |
| [color=var(--color-prettylights-syntax-comment)] * Xorout: 0xFFFF |
| [color=var(--color-prettylights-syntax-comment)] * Use: M-Bus,ect. |
| [color=var(--color-prettylights-syntax-comment)] *****************************************************************************/ |
| [color=var(--color-prettylights-syntax-constant)]uint16_t [color=var(--color-prettylights-syntax-entity)]crc16_dnp([color=var(--color-prettylights-syntax-constant)]uint8_t *data, [color=var(--color-prettylights-syntax-constant)]uint16_t length) |
| { |
| [color=var(--color-prettylights-syntax-constant)]uint8_t i; |
| [color=var(--color-prettylights-syntax-constant)]uint16_t crc = [color=var(--color-prettylights-syntax-constant)]0; [color=var(--color-prettylights-syntax-comment)]// Initial value |
| [color=var(--color-prettylights-syntax-keyword)]while(length--) |
| { |
| crc ^= *data++; [color=var(--color-prettylights-syntax-comment)]// crc ^= *data; data++; |
| [color=var(--color-prettylights-syntax-keyword)]for (i = [color=var(--color-prettylights-syntax-constant)]0; i < [color=var(--color-prettylights-syntax-constant)]8; ++i) |
| { |
| [color=var(--color-prettylights-syntax-keyword)]if (crc & [color=var(--color-prettylights-syntax-constant)]1) |
| crc = (crc >> [color=var(--color-prettylights-syntax-constant)]1) ^ [color=var(--color-prettylights-syntax-constant)]0xA6BC; [color=var(--color-prettylights-syntax-comment)]// 0xA6BC = reverse 0x3D65 |
| [color=var(--color-prettylights-syntax-keyword)]else |
| crc = (crc >> [color=var(--color-prettylights-syntax-constant)]1); |
| } |
| } |
| [color=var(--color-prettylights-syntax-keyword)]return ~crc; [color=var(--color-prettylights-syntax-comment)]// crc^Xorout |
| } |
| |
| [color=var(--color-prettylights-syntax-comment)]/****************************************************************************** |
| [color=var(--color-prettylights-syntax-comment)] * Name: CRC-32 x32+x26+x23+x22+x16+x12+x11+x10+x8+x7+x5+x4+x2+x+1 |
| [color=var(--color-prettylights-syntax-comment)] * Poly: 0x4C11DB7 |
| [color=var(--color-prettylights-syntax-comment)] * Init: 0xFFFFFFF |
| [color=var(--color-prettylights-syntax-comment)] * Refin: True |
| [color=var(--color-prettylights-syntax-comment)] * Refout: True |
| [color=var(--color-prettylights-syntax-comment)] * Xorout: 0xFFFFFFF |
| [color=var(--color-prettylights-syntax-comment)] * Alias: CRC_32/ADCCP |
| [color=var(--color-prettylights-syntax-comment)] * Use: WinRAR,ect. |
| [color=var(--color-prettylights-syntax-comment)] *****************************************************************************/ |
| [color=var(--color-prettylights-syntax-constant)]uint32_t [color=var(--color-prettylights-syntax-entity)]crc32([color=var(--color-prettylights-syntax-constant)]uint8_t *data, [color=var(--color-prettylights-syntax-constant)]uint16_t length) |
| { |
| [color=var(--color-prettylights-syntax-constant)]uint8_t i; |
| [color=var(--color-prettylights-syntax-constant)]uint32_t crc = [color=var(--color-prettylights-syntax-constant)]0xffffffff; [color=var(--color-prettylights-syntax-comment)]// Initial value |
| [color=var(--color-prettylights-syntax-keyword)]while(length--) |
| { |
| crc ^= *data++; [color=var(--color-prettylights-syntax-comment)]// crc ^= *data; data++; |
| [color=var(--color-prettylights-syntax-keyword)]for (i = [color=var(--color-prettylights-syntax-constant)]0; i < [color=var(--color-prettylights-syntax-constant)]8; ++i) |
| { |
| [color=var(--color-prettylights-syntax-keyword)]if (crc & [color=var(--color-prettylights-syntax-constant)]1) |
| crc = (crc >> [color=var(--color-prettylights-syntax-constant)]1) ^ [color=var(--color-prettylights-syntax-constant)]0xEDB88320;[color=var(--color-prettylights-syntax-comment)]// 0xEDB88320= reverse 0x04C11DB7 |
| [color=var(--color-prettylights-syntax-keyword)]else |
| crc = (crc >> [color=var(--color-prettylights-syntax-constant)]1); |
| } |
| } |
| [color=var(--color-prettylights-syntax-keyword)]return ~crc; |
| } |
| |
| [color=var(--color-prettylights-syntax-comment)]/****************************************************************************** |
| [color=var(--color-prettylights-syntax-comment)] * Name: CRC-32/MPEG-2 x32+x26+x23+x22+x16+x12+x11+x10+x8+x7+x5+x4+x2+x+1 |
| [color=var(--color-prettylights-syntax-comment)] * Poly: 0x4C11DB7 |
| [color=var(--color-prettylights-syntax-comment)] * Init: 0xFFFFFFF |
| [color=var(--color-prettylights-syntax-comment)] * Refin: False |
| [color=var(--color-prettylights-syntax-comment)] * Refout: False |
| [color=var(--color-prettylights-syntax-comment)] * Xorout: 0x0000000 |
| [color=var(--color-prettylights-syntax-comment)] * Note: |
| [color=var(--color-prettylights-syntax-comment)] *****************************************************************************/ |
| [color=var(--color-prettylights-syntax-constant)]uint32_t [color=var(--color-prettylights-syntax-entity)]crc32_mpeg_2([color=var(--color-prettylights-syntax-constant)]uint8_t *data, [color=var(--color-prettylights-syntax-constant)]uint16_t length) |
| { |
| [color=var(--color-prettylights-syntax-constant)]uint8_t i; |
| [color=var(--color-prettylights-syntax-constant)]uint32_t crc = [color=var(--color-prettylights-syntax-constant)]0xffffffff; [color=var(--color-prettylights-syntax-comment)]// Initial value |
| [color=var(--color-prettylights-syntax-keyword)]while(length--) |
| { |
| crc ^= ([color=var(--color-prettylights-syntax-constant)]uint32_t)(*data++) << [color=var(--color-prettylights-syntax-constant)]24;[color=var(--color-prettylights-syntax-comment)]// crc ^=(uint32_t)(*data)<<24; data++; |
| [color=var(--color-prettylights-syntax-keyword)]for (i = [color=var(--color-prettylights-syntax-constant)]0; i < [color=var(--color-prettylights-syntax-constant)]8; ++i) |
| { |
| [color=var(--color-prettylights-syntax-keyword)]if ( crc & [color=var(--color-prettylights-syntax-constant)]0x80000000 ) |
| crc = (crc << [color=var(--color-prettylights-syntax-constant)]1) ^ [color=var(--color-prettylights-syntax-constant)]0x04C11DB7; |
| [color=var(--color-prettylights-syntax-keyword)]else |
| crc <<= [color=var(--color-prettylights-syntax-constant)]1; |
| } |
| } |
| [color=var(--color-prettylights-syntax-keyword)]return crc; |
| } |