aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.8.1/gcc/testsuite/g++.dg/torture/pr53693.C
blob: b67a484b9690a4cdabc820eaa95dc1cd25b681c4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// { dg-do compile }

void
filter_scanlines (void *src_buffer, void *dst_buffer, int dst_pitch, int width)
{
  int x;
  unsigned short *src, *dst_a, *dst_b;

  src = (unsigned short *) src_buffer;
  dst_a = (unsigned short *) dst_buffer;
  dst_b = ((unsigned short *) dst_buffer) + (dst_pitch >> 1);

  for (x = 0; x < width; x++)
    {
      unsigned char gs, gh;
      gs = src[x];
      gh = gs + (gs >> 1);
      dst_a[x] = (gh << 5) | (gh);
      dst_b[x] = ((gs  - gh) << 5)  | (gs  - gh);
    }
}