| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-options "-fdump-tree-crc-details -O2" } */ |
| 3 |
/* { dg-require-effective-target int32plus } */ |
| 4 |
|
| 5 |
//File - Ac3 from Fedora, polynomial made const. Original crc-side-instr-21.c test |
| 6 |
#include <stddef.h> |
| 7 |
typedef unsigned short int16u; |
| 8 |
typedef unsigned char int8u; |
| 9 |
int CRC16_Init(int16u *Table) |
| 10 |
{ |
| 11 |
for (size_t Pos=0; Pos<256; Pos++) |
| 12 |
{ |
| 13 |
Table[Pos]=(int16u)Pos<<8; |
| 14 |
|
| 15 |
for(int8u bit=0; bit<8; bit++) |
| 16 |
{ |
| 17 |
if (Table[Pos]&0x8000) |
| 18 |
Table[Pos]=(Table[Pos]<<1)^0x2101; |
| 19 |
else |
| 20 |
Table[Pos]=Table[Pos]<<1; |
| 21 |
} |
| 22 |
} |
| 23 |
return 0; |
| 24 |
} |
| 25 |
|
| 26 |
/* { dg-final { scan-tree-dump "calculates CRC!" "crc" } } */ |