[llvm-commits] CVS: llvm-test/SingleSource/Benchmarks/Shootout-C++/sieve.cpp
Reid Spencer
reid at x10sys.com
Fri Nov 17 13:22:40 PST 2006
Changes in directory llvm-test/SingleSource/Benchmarks/Shootout-C++:
sieve.cpp updated: 1.2 -> 1.3
---
Log message:
Fix indentation of this program, remove tabs. No functional change.
---
Diffs of the changes: (+26 -27)
sieve.cpp | 53 ++++++++++++++++++++++++++---------------------------
1 files changed, 26 insertions(+), 27 deletions(-)
Index: llvm-test/SingleSource/Benchmarks/Shootout-C++/sieve.cpp
diff -u llvm-test/SingleSource/Benchmarks/Shootout-C++/sieve.cpp:1.2 llvm-test/SingleSource/Benchmarks/Shootout-C++/sieve.cpp:1.3
--- llvm-test/SingleSource/Benchmarks/Shootout-C++/sieve.cpp:1.2 Tue Jun 15 15:48:16 2004
+++ llvm-test/SingleSource/Benchmarks/Shootout-C++/sieve.cpp Fri Nov 17 15:22:26 2006
@@ -7,38 +7,37 @@
void sieve(list<int>& unknown, vector<int>& primes)
{
- while (!unknown.empty())
- {
- int p = unknown.front();
- unknown.pop_front();
- list<int>::iterator i = unknown.begin();
- while (i != unknown.end())
- {
- if (*i % p)
- ++i;
- else
- i = unknown.erase(i);
- }
- primes.push_back(p);
- }
+ while (!unknown.empty())
+ {
+ int p = unknown.front();
+ unknown.pop_front();
+ list<int>::iterator i = unknown.begin();
+ while (i != unknown.end())
+ {
+ if (*i % p)
+ ++i;
+ else
+ i = unknown.erase(i);
+ }
+ primes.push_back(p);
+ }
}
int main(int argc, char *argv[])
{
- size_t NUM = (argc == 2 ? (atoi(argv[1]) < 1 ? 1 : atoi(argv[1])):
- 500);
+ size_t NUM = (argc == 2 ? (atoi(argv[1]) < 1 ? 1 : atoi(argv[1])): 500);
- vector<int> primes;
+ vector<int> primes;
- // run the sieve repeatedly
- while (NUM--) {
- list<int> integers;
- for (int i = 2; i < 8192; ++i)
- integers.push_back(i);
- primes.clear();
- sieve(integers, primes);
- }
+ // run the sieve repeatedly
+ while (NUM--) {
+ list<int> integers;
+ for (int i = 2; i < 8192; ++i)
+ integers.push_back(i);
+ primes.clear();
+ sieve(integers, primes);
+ }
- cout << "Count: " << primes.size() << endl;
- return 0;
+ cout << "Count: " << primes.size() << endl;
+ return 0;
}
More information about the llvm-commits
mailing list