Debian Codegraph @

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

raw
1 /* { dg-do compile } */
2 /* { dg-options "-fdump-tree-crc-details -O2" } */
3 /* { dg-require-effective-target int32plus } */
4
5 // File - base64, slightly modified
6 // We don't support the case when leading bit of the polynomial is kept.
7
8 #include <stdint.h>
9 #include <stdlib.h>
10
11 uint32_t b64crc (const unsigned char* data, size_t ns)
12 {
13 if (sizeof (unsigned int) < 4)
14 exit (0);
15
16 const unsigned char *s = data;
17 uint32_t crc = 0xb704ceL;
18
19 while (ns-- > 0)
20 {
21 int i;
22 crc ^= (*s++) << 16;
23 for (i = 0; i < 8; i++)
24 {
25 crc <<= 1;
26 if (crc & 0x1000000)
27 crc ^= 0x1864cfbL;
28 }
29 }
30 crc &= 0xffffff;
31 /* ... */
32 return crc;
33 }
34
35 /* { dg-final { scan-tree-dump "Polynomial's value is \\\{\[0, \]*0\\\}" "crc" } } */
36 /* { dg-final { scan-tree-dump "maybe contains CRC calculation." "crc" } } */