1 /* { dg-do compile } */
2 
3 typedef unsigned char Uint8;
4 typedef int Sint32;
5 typedef unsigned int Uint32;
6 
7 typedef union RMColorDataRef
8 {
9   Uint8* data8;
10 } RMColorDataRef;
11 
12 typedef struct RMColorData
13 {
14   Uint32 dataCount;
15   RMColorDataRef dataRef;
16 } RMColorData;
17 
18 typedef struct RMColorTable
19 {
20   Uint8 dataCompsOut;
21   RMColorDataRef dataRef;
22 } RMColorTable;
23 
fail(const RMColorData * pInColor,RMColorData * pOutColor,const RMColorTable * pColorTable)24 int fail ( const RMColorData * pInColor,
25 	   RMColorData * pOutColor,
26 	   const RMColorTable * pColorTable )
27 {
28   Uint32 comp;
29   Uint8 nCompOut;
30 
31   Sint32 result;
32 
33   Uint32 interpFrac1, interpFrac2, interpFrac3;
34   Sint32 val0, val1, val2, val3;
35 
36   Uint8 * pOut;
37 
38   const Uint8 * pClutData;
39   const Uint8 * pCornerPoint0;
40 
41   Uint8 lastOut[((8) > (4) ? (8) : (4))];
42 
43   pOut = pOutColor->dataRef.data8;
44   pClutData = pColorTable->dataRef.data8;
45 
46   nCompOut = pColorTable->dataCompsOut;
47 
48   pCornerPoint0 = pClutData;
49 
50   for (comp = 0; comp < nCompOut; comp++)
51     {
52       val0 = *pCornerPoint0++;
53 
54       result = val0 << 4;
55 
56       result += (val1 - val0) * interpFrac1;
57       result += (val2 - val1) * interpFrac2;
58       result += (val3 - val2) * interpFrac3;
59 
60       *pOut++ = lastOut[comp] = (Uint8)(result >> 4);
61     }
62 
63   return (0);
64 }
65 
66