Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Zwinkau
libfirm
Commits
4c26efa6
Commit
4c26efa6
authored
Aug 09, 2006
by
Christian Würdig
Browse files
runs more often for benchmarking
parent
bf4361e6
Changes
1
Hide whitespace changes
Inline
Side-by-side
ir/be/test/gcd_bench.c
0 → 100644
View file @
4c26efa6
#include
<stdio.h>
#include
<limits.h>
int
gcd
(
int
a
,
int
b
)
{
int
i
=
0
;
while
(
a
!=
b
)
{
if
(
a
>
b
)
{
a
=
a
-
b
;
}
else
{
b
=
b
-
a
;
}
++
i
;
}
return
a
;
}
void
gcd_no_out
(
void
)
{
int
i
,
j
;
for
(
i
=
1
;
i
<
10000
;
i
++
)
{
for
(
j
=
1
;
j
<
10000
;
j
++
)
{
gcd
(
i
,
j
);
}
}
}
void
gcd_out
(
void
)
{
int
i
,
j
;
for
(
i
=
1
;
i
<
1000
;
i
++
)
{
for
(
j
=
1
;
j
<
1000
;
j
++
)
{
printf
(
"gcd(%d, %d) = %d
\n
"
,
i
,
j
,
gcd
(
i
,
j
));
}
}
}
int
main
(
int
argc
)
{
printf
(
"gcd.c
\n
"
);
if
(
argc
>
1
)
{
gcd_no_out
();
}
else
{
gcd_out
();
}
return
0
;
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment