blob: 046629f2c6c3d4d54963206be795fb4cdefd6634 [file] [log] [blame]
John Kessenich88e22a62017-11-02 06:48:32 -06001#define f1(i) ((i)*(i))
2#define I2(f, n) f(n) + f(n+1)
3#define I3(f, n) I2(f, n) + f(n+2)
4
John Kessenich1ea1b132018-05-24 18:11:47 -06005#define FL_f1(i) ((i)*(i))
6#define FL_I2(f, n) f(n) + f(n+0.2)
7#define FL_I3(f, n) FL_I2(f, n) + f(n+0.5)
8
John Kessenich88e22a62017-11-02 06:48:32 -06009void main()
10{
11 int f1 = 4;
12 int f2 = f1;
13 int f3 = f1(3);
14 int f4 = I2(f1, 0);
15 int f5 = I3(f1, 0);
John Kessenich1ea1b132018-05-24 18:11:47 -060016
17 highp float fl_f5 = FL_I3(FL_f1, 0.1);
John Kessenich88e22a62017-11-02 06:48:32 -060018}
John Kessenich1ea1b132018-05-24 18:11:47 -060019
20// f5 = I3(f1, 0)
21// = I2(f1, 0) + f1(0 + 2)
22// = f1(0) + f1(0+1) + f1(0+2)
23// = 0*0 + 1*1 + 2*2
24// = 5
25
26// fl_f5 = FL_I3(FL_f1, 0.1)
27// = FL_I2(FL_f1, 0.1) + FL_f1(0.1 + 0.5)
28// = FL_f1(0.1) + FL_f1(0.1 + 0.2) + FL_f1(0.1 + 0.5)
29// = 0.1*0.1 + 0.3*0.3 + 0.6*0.6
30// = 0.46