Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Wim Lewis
nettle
Commits
9f7da3eb
Commit
9f7da3eb
authored
Oct 24, 2007
by
Niels Möller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Introduced OUTPUT macro.
Rev: nettle/examples/eratosthenes.c:1.6
parent
2138baab
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
4 deletions
+8
-4
examples/eratosthenes.c
examples/eratosthenes.c
+8
-4
No files found.
examples/eratosthenes.c
View file @
9f7da3eb
...
...
@@ -176,6 +176,10 @@ vector_find_next (const unsigned long *vector, unsigned long bit, unsigned long
return
i
*
BITS_PER_LONG
+
find_first_one
(
word
);
}
/* For benchmarking, define to do nothing (otherwise, most of the time
will be spent converting the output to decimal). */
#define OUTPUT(n) printf("%lu\n", (n))
int
main
(
int
argc
,
char
**
argv
)
{
...
...
@@ -242,7 +246,7 @@ main (int argc, char **argv)
return
EXIT_FAILURE
;
}
printf
(
"2
\n
"
);
OUTPUT
(
2UL
);
bit
=
0
;
...
...
@@ -255,7 +259,7 @@ main (int argc, char **argv)
{
unsigned
long
n
=
3
+
2
*
bit
;
printf
(
"%lu
\n
"
,
n
);
OUTPUT
(
n
);
/* First bit to clear corresponds to n^2, which is bit
...
...
@@ -270,7 +274,7 @@ main (int argc, char **argv)
for
(;
bit
<
block_size
;
bit
=
vector_find_next
(
vector
,
bit
+
1
,
size
))
printf
(
"%lu
\n
"
,
3
+
2
*
bit
);
OUTPUT
(
3
+
2
*
bit
);
for
(
block
=
block_size
;
block
<
size
;
block
+=
block_size
)
{
...
...
@@ -302,7 +306,7 @@ main (int argc, char **argv)
for
(
bit
=
vector_find_next
(
vector
,
block
,
block
+
block_size
);
bit
<
block
+
block_size
;
bit
=
vector_find_next
(
vector
,
bit
+
1
,
block
+
block_size
))
printf
(
"%lu
\n
"
,
3
+
2
*
bit
);
OUTPUT
(
3
+
2
*
bit
);
}
return
EXIT_SUCCESS
;
...
...
Write
Preview
Markdown
is supported
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