Debian Codegraph @

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

raw
1 /* { dg-do compile } */
2 /* { dg-options "-fdump-tree-crc -O2" } */
3
4 #include <stdint.h>
5
6 //shift and xor only if lsb is 1
7 uint16_t not_crc(uint16_t crc, uint8_t a) {
8 int i;
9 crc ^= a;
10 for (i = 0; i < 8; ++i) {
11 if (crc & 1)
12 crc = (crc >> 1) ^ 0xA001;
13 }
14 return crc;
15 }
16
17 /* { dg-final { scan-tree-dump-times "not_crc function maybe contains CRC calculation" 0 "crc" } } */
18