gcc/testsuite/gcc.dg/crc-not-crc-20.c
raw| 1 | /* { dg-do compile } */ |
| 2 | /* { dg-options "-fdump-tree-crc -O2" } */ |
| 3 | |
| 4 | #include <stdint.h> |
| 5 | |
| 6 | uint8_t not_crc(uint8_t crc, uint8_t data) { |
| 7 | uint8_t i; |
| 8 | crc = crc ^ data; |
| 9 | for (i = 0; i < 8; i++) { |
| 10 | if (i == 0 || (crc & 0x01)) |
| 11 | crc = (crc >> 1) ^ 0x8C; |
| 12 | else |
| 13 | crc >>= 1; |
| 14 | } |
| 15 | return crc; |
| 16 | } |
| 17 | |
| 18 | /* { dg-final { scan-tree-dump-times "calculates CRC!" 0 "crc" } } */ |