comparison CbC-examples/parallel_check/c-int.c @ 42:9e4f9e20b8f1

add some examples.
author kent@teto.cr.ie.u-ryukyu.ac.jp
date Mon, 25 Jan 2010 17:13:59 +0900
parents
children 5d30d517ebed
comparison
equal deleted inserted replaced
41:c816ae4380d7 42:9e4f9e20b8f1
1 #include<stdio.h>
2 #define dprint(f, args...) \
3 printf("in %s env=%p: "f, __FUNCTION__, __builtin_frame_address(1), ## args)
4
5 void
6 callee(int a, int b, int c, int d)
7 {
8 int r;
9 dprint("a=%d,b=%d,c=%d,d=%d\n", a,b,c,d);
10 r = a+b+c+d;
11 printf("r = %d\n", r);
12 return;
13 }
14
15 void
16 caller1(int a, int b, int c, int d)
17 {
18 int x,y,z,w;
19 x=a, y=b;
20 z=c, w=d;
21
22 callee(x,y,z,w);
23 return;
24 }
25
26 void
27 caller2(int a, int b, int c, int d)
28 {
29 int x,y,z,w;
30 x=a, y=b;
31 z=c, w=d;
32
33 callee(y,z,w,x);
34 return;
35 }
36
37 void
38 caller3(int a, int b, int c, int d)
39 {
40 callee(b,c,d,a);
41 return;
42 }
43
44 void
45 caller4(int a, int b, int c, int d)
46 {
47 callee(a+b,b+c,c+d,d+a);
48 return;
49 }
50
51 void
52 caller5(int a, int b, int c, int d)
53 {
54 int x,y,z,w;
55 x = a+b;
56 y = b+c;
57 z = c+d;
58 w = d+a;
59
60 callee(x,y,z,w);
61 return;
62 }
63
64 int
65 main (int argc, char **argv)
66 {
67 int r;
68 caller(11,22,33,44);
69 //r = caller(11,22,33,44, 55,66,77,88);
70 }
71