Debian Codegraph @

gcc/testsuite/gcc.dg/crc-not-crc-5.c

raw
1 /* { dg-do compile } */
2 /* { dg-options "-fdump-tree-crc -O2" } */
3
4 #include <stdio.h>
5
6 typedef unsigned char uint8_t;
7
8 //no xor
9 uint8_t not_crc(uint8_t *data, size_t len) {
10 uint8_t crc = 0xff;
11 size_t i, j;
12 for (i = 0; i < len; i++) {
13 crc ^= data[i];
14 for (j = 0; j < 8; j++) {
15 if ((crc & 0x80) != 0)
16 crc = (uint8_t) ((crc << 1) | 0x31);
17 else
18 crc <<= 1;
19 }
20 }
21 return crc;
22 }
23
24 /* { dg-final { scan-tree-dump-times "not_crc function maybe contains CRC calculation" 0 "crc" } } */
25
26