Debian Codegraph @

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

raw
1 /* { dg-do compile } */
2 /* { dg-options "-fdump-tree-crc -O2" } */
3
4 #include <stdint.h>
5
6 uint16_t not_crcu8 (uint8_t *data, uint16_t crc) {
7 uint8_t x16 = 0, carry = 0;
8 for (uint8_t i = 0, j=4; i < 8; i++, j+=2) {
9 x16 = (uint8_t) (((uint8_t) crc & 1) ^ (j & 1));
10 *data >>= 1;
11 if (x16 == 1) {
12 crc ^= 0x4002;
13 carry = 1;
14 } else
15 carry = 0;
16 crc >>= 1;
17 if (carry)
18 crc |= 0x8000;
19 else
20 crc &= 0x7fff;
21 }
22 return crc;
23 }
24
25 /* { dg-final { scan-tree-dump-times "calculates CRC!" 0 "crc" } } */