projects
/
libfirm
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
history
|
raw
|
HEAD
Added some stuff
[libfirm]
/
ir
/
be
/
test
/
While.c
1
//
2
// $Id$
3
//
4
// Testprogram to test gcc-firm : While loop
5
6
#include <stdio.h>
7
8
static int test (int i) {
9
int j;
10
j = 0;
11
while(i > 0) {
12
i = i - 1;
13
if(i == 3)
14
break;
15
}
16
printf(" 3 == %d\n", i);
17
return(j);
18
}
19
20
static int gcd (int a, int b) {
21
int i = 0;
22
23
while((a != b) && (i >= 0)){
24
if(a > b) {
25
a = a - b;
26
}
27
else {
28
b = b - a;
29
}
30
++i;
31
}
32
return(a);
33
}
34
35
int main (int argc, char *argv[]) {
36
printf("While.c\n");
37
printf(" 5 == %d\n", gcd(20, 15));
38
test(10);
39
return 0;
40
}