Debian Codegraph @

gcc/testsuite/gcc.dg/crc-from-fedora-packages-10.c

raw
1 /* { dg-do compile } */
2 /* { dg-options "-fdump-tree-crc-details -O2" } */
3
4 // File - protocol
5 #include <stdint.h>
6 #include <stddef.h>
7 uint16_t crc16_mcrf4xx(uint16_t crc, uint8_t *data, size_t len) {
8 int i;
9
10 if (!data || !len)
11 return crc;
12
13 while (len--) {
14 crc ^= *data++;
15 for (i = 0; i < 8; i++) {
16 if (crc & 1)
17 crc = (crc >> 1) ^ 0x8408;
18 else
19 crc = (crc >> 1);
20 }
21 }
22
23 return crc;
24 }
25
26 /* { dg-final { scan-tree-dump "calculates CRC!" "crc" } } */