OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-stable/] [gcc-4.5.1/] [gcc/] [testsuite/] [gcc.c-torture/] [execute/] [20000605-1.c] - Blame information for rev 297

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 297 jeremybenn
typedef struct _RenderInfo RenderInfo;
2
struct _RenderInfo
3
{
4
    int y;
5
    float scaley;
6
    int src_y;
7
};
8
 
9
static void bar(void) { }
10
 
11
static int
12
render_image_rgb_a (RenderInfo * info)
13
{
14
  int y, ye;
15
  float error;
16
  float step;
17
 
18
  y = info->y;
19
  ye = 256;
20
 
21
  step = 1.0 / info->scaley;
22
 
23
  error = y * step;
24
  error -= ((int) error) - step;
25
 
26
  for (; y < ye; y++) {
27
      if (error >= 1.0) {
28
          info->src_y += (int) error;
29
          error -= (int) error;
30
          bar();
31
      }
32
      error += step;
33
  }
34
  return info->src_y;
35
}
36
 
37
int main (void)
38
{
39
    RenderInfo info;
40
 
41
    info.y = 0;
42
    info.src_y = 0;
43
    info.scaley = 1.0;
44
 
45
    if (render_image_rgb_a(&info) != 256)
46
       abort ();
47
    exit(0);
48
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.