projects
/
libfirm
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
updated for new optimization
[libfirm]
/
ir
/
be
/
test
/
tailrec.c
diff --git
a/ir/be/test/tailrec.c
b/ir/be/test/tailrec.c
index
751be00
..
4bac479
100644
(file)
--- a/
ir/be/test/tailrec.c
+++ b/
ir/be/test/tailrec.c
@@
-1,14
+1,11
@@
-static unsigned _fak(unsigned a, unsigned b)
-{
- if (a == 0)
- return b;
-
- return _fak(a-1, a*b);
-}
+#include <stdio.h>
-static
fak(unsigned a
)
+static
unsigned fak(unsigned n
)
{
{
- return _fak(a, 1);
+ if (n == 0)
+ return 1;
+
+ return n * fak(n - 1);
}
}