Debian Codegraph @

gcc/testsuite/gcc.dg/crc-from-fedora-packages-7.c

raw
1 /* { dg-do compile } */
2 /* { dg-options "-fdump-tree-crc-details -O2" } */
3
4 // File - lsf_decode, modified.
5 // We don't support this case.
6
7 #include <stddef.h>
8 #include <stdint.h>
9
10 uint16_t crc(uint8_t byte, uint16_t reg) {
11 for (size_t i = 0; i != 8; ++i) {
12 uint16_t msb = reg & 0x8000;
13 reg = ((reg << 1) & 0xFFFF) | ((byte >> (7 - i)) & 0x0001);
14 if (msb) reg ^= 0x5935;
15 }
16 return reg & 0xFFFF;
17 }
18 /* { dg-final { scan-tree-dump "maybe contains CRC calculation." "crc" } } */