Debian Codegraph @

gcc/testsuite/gcc.dg/torture/crc-24.c

raw
1 /* { dg-do compile } */
2 /* { dg-options "-fdump-tree-crc" } */
3 /* { dg-skip-if "" { *-*-* } { "-O0" "-O1" "-Os" "-flto" } } */
4
5 // Modified Coremark test, we don't detect.
6
7 #include <stdint.h>
8
9 uint16_t not_crcu8 (uint16_t data, uint16_t crc)
10 {
11 uint16_t i = 0, carry = 0;
12 for (i = 0; i < 16; i++)
13 {
14 if ((((crc & 1) == 1) && ((data & 1) == 0))
15 || (((crc & 1) == 0) && (data & 1) == 1))
16 {
17 crc ^= 0x4002;
18 carry = 1;
19 }
20 else
21 carry = 0;
22 crc >>= 1;
23 data >>= 1;
24 if (carry)
25 crc |= 0x8000;
26 else
27 crc &= 0x7fff;
28 }
29 return crc;
30 }