gcc/testsuite/gcc.dg/crc-not-crc-3.c
raw| 1 | /* { dg-do compile } */ |
| 2 | /* { dg-options "-fdump-tree-crc -O2" } */ |
| 3 | |
| 4 | #include <stdint.h> |
| 5 | |
| 6 | //no shift in case of xor |
| 7 | uint16_t not_crc16_update(uint16_t crc, uint8_t a) { |
| 8 | |
| 9 | int i; |
| 10 | crc ^= a; |
| 11 | for (i = 0; i < 8; ++i) { |
| 12 | if (crc & 1) |
| 13 | crc = crc ^ 0xA001; |
| 14 | else |
| 15 | crc = (crc >> 1); |
| 16 | } |
| 17 | return crc; |
| 18 | } |
| 19 | |
| 20 | /* { dg-final { scan-tree-dump-times "not_crc16_update function maybe contains CRC calculation" 0 "crc" } } */ |
| 21 |