Last change
on this file since 116 was
115,
checked in by rosiere, 15 years ago
|
1) Write queue with mealy
2) Network : fix bug
3) leak memory
|
-
Property svn:keywords set to
Id
|
File size:
709 bytes
|
Line | |
---|
1 | // $Id: main.c 115 2009-04-20 21:29:17Z rosiere $ |
---|
2 | |
---|
3 | //=====[ main ]================================================================= |
---|
4 | /* |
---|
5 | * All thread execute this routine |
---|
6 | * Initialize the thread and attribute a Workload at each thread |
---|
7 | */ |
---|
8 | |
---|
9 | #include "func_math.h" |
---|
10 | #include "func_fibonnacci.h" |
---|
11 | #include "func_premier.h" |
---|
12 | #include "func_factoriel.h" |
---|
13 | #include "func_io.h" |
---|
14 | |
---|
15 | #define mul(x,y) x*y |
---|
16 | |
---|
17 | unsigned int f1 (unsigned int x) |
---|
18 | { |
---|
19 | if ( x <= 1) |
---|
20 | return 1; |
---|
21 | |
---|
22 | unsigned int res = mul (x , f1 (x-1)); |
---|
23 | |
---|
24 | return res; |
---|
25 | } |
---|
26 | |
---|
27 | unsigned int f2 (unsigned int x) |
---|
28 | { |
---|
29 | unsigned int res= 1; |
---|
30 | |
---|
31 | while (x > 1) |
---|
32 | { |
---|
33 | res = mul(res,x); |
---|
34 | x --; |
---|
35 | } |
---|
36 | return res; |
---|
37 | } |
---|
38 | |
---|
39 | int main() |
---|
40 | { |
---|
41 | for (int i=0; i<500; ++i) |
---|
42 | if (f2 (12) != 479001600) quit(i); |
---|
43 | quit(0); |
---|
44 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.