OSDN Git Service

Backported from mainline
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.c-torture / compile / pr28675.c
1 struct fb_cmap {
2  unsigned int start;
3  unsigned int len;
4  unsigned short *red;
5  unsigned short *green;
6  unsigned short *blue;
7  unsigned short *transp;
8 };
9
10 typedef struct {
11     int r;
12     int g;
13     int b;
14     int a;
15 } rgba_t;
16
17 static unsigned int cmap_len;
18
19 extern unsigned int red_len, green_len, blue_len, alpha_len;
20 extern struct fb_cmap fb_cmap;
21 extern rgba_t *clut;
22 extern int fb_set_cmap(void);
23
24 void directcolor_update_cmap(void)
25 {
26     unsigned int i;
27
28     for (i = 0; i < cmap_len; i++) {
29       if (i < red_len)
30         fb_cmap.red[i] = clut[i].r;
31       if (i < green_len)
32         fb_cmap.green[i] = clut[i].g;
33       if (i < blue_len)
34         fb_cmap.blue[i] = clut[i].b;
35       if (fb_cmap.transp && i < alpha_len)
36         fb_cmap.transp[i] = clut[i].a;
37     }
38 }