From b27aa02a57b3aade4059ab88053ed4dfd08f604c Mon Sep 17 00:00:00 2001 From: David Kaufmann Date: Fri, 13 Jan 2012 18:52:19 +0100 Subject: [PATCH] int -> unsigned int --- openmp/prefix/algorithm_1.c | 4 ++-- openmp/prefix/algorithm_1.h | 2 +- openmp/prefix/algorithm_2.c | 2 +- openmp/prefix/algorithm_2.h | 2 +- openmp/prefix/algorithm_3.c | 2 +- openmp/prefix/algorithm_3.h | 2 +- openmp/prefix/prefix.c | 10 +++++----- openmp/prefix/prefix.h | 2 +- 8 files changed, 13 insertions(+), 13 deletions(-) diff --git a/openmp/prefix/algorithm_1.c b/openmp/prefix/algorithm_1.c index ed0a1be..7b549de 100644 --- a/openmp/prefix/algorithm_1.c +++ b/openmp/prefix/algorithm_1.c @@ -3,8 +3,8 @@ */ #include "algorithm_1.h" -void algorithm_1 (numtype x[], int n, int ops[]) { - int i; +void algorithm_1 (numtype x[], unsigned int n, unsigned int ops[]) { + unsigned int i; numtype y[n/2]; if (n == 1) { return; diff --git a/openmp/prefix/algorithm_1.h b/openmp/prefix/algorithm_1.h index c6c9ded..f171fcb 100644 --- a/openmp/prefix/algorithm_1.h +++ b/openmp/prefix/algorithm_1.h @@ -4,4 +4,4 @@ #include #include "prefix.h" -void algorithm_1 (numtype y[], int n, int ops[]); +void algorithm_1 (numtype y[], unsigned int n, unsigned int ops[]); diff --git a/openmp/prefix/algorithm_2.c b/openmp/prefix/algorithm_2.c index bfef559..633c8c7 100644 --- a/openmp/prefix/algorithm_2.c +++ b/openmp/prefix/algorithm_2.c @@ -3,6 +3,6 @@ */ #include "algorithm_2.h" -int algorithm_2 (numtype y[], int n, int ops[]) { +void algorithm_2 (numtype y[], unsigned int n, unsigned int ops[]) { return 0; } diff --git a/openmp/prefix/algorithm_2.h b/openmp/prefix/algorithm_2.h index 5bedbae..c9e3939 100644 --- a/openmp/prefix/algorithm_2.h +++ b/openmp/prefix/algorithm_2.h @@ -4,4 +4,4 @@ #include #include "prefix.h" -int algorithm_2 (numtype y[], int n, int ops[]); +void algorithm_2 (numtype y[], unsigned int n, unsigned int ops[]); diff --git a/openmp/prefix/algorithm_3.c b/openmp/prefix/algorithm_3.c index 943b8c4..1a86a3e 100644 --- a/openmp/prefix/algorithm_3.c +++ b/openmp/prefix/algorithm_3.c @@ -3,6 +3,6 @@ */ #include "algorithm_3.h" -int algorithm_3 (numtype y[], int n, int ops[]) { +void algorithm_3 (numtype y[], unsigned int n, unsigned int ops[]) { return 0; } diff --git a/openmp/prefix/algorithm_3.h b/openmp/prefix/algorithm_3.h index 92ca041..97e94ce 100644 --- a/openmp/prefix/algorithm_3.h +++ b/openmp/prefix/algorithm_3.h @@ -4,4 +4,4 @@ #include #include "prefix.h" -int algorithm_3 (numtype y[], int n, int ops[]); +void algorithm_3 (numtype y[], unsigned int n, unsigned int ops[]); diff --git a/openmp/prefix/prefix.c b/openmp/prefix/prefix.c index fe8c0aa..ca6948e 100644 --- a/openmp/prefix/prefix.c +++ b/openmp/prefix/prefix.c @@ -10,32 +10,32 @@ int main (int argc, char* argv[]) { int result = 0; numtype numarray[NUMBERS]; - int countarray[NUMBERS]; + //unsigned int countarray[NUMBERS]; int i; double startTime, endTime; for (i = 0; i < NUMBERS; i++) { numarray[i] = 10; - countarray[i] = 0; + //countarray[i] = 0; } startTime = omp_get_wtime(); printf ("calling algorithm 1:"); - algorithm_1(numarray, NUMBERS, countarray); + algorithm_1(numarray, NUMBERS, NULL); printf ("sum: %i\n", numarray[NUMBERS-1]); endTime = omp_get_wtime(); printf("took %f seconds.\n", endTime-startTime); startTime = omp_get_wtime(); printf ("calling algorithm 2:"); - result = algorithm_2(numarray, NUMBERS, countarray); + result = algorithm_2(numarray, NUMBERS, NULL); printf ("sum: %i\n", result); endTime = omp_get_wtime(); printf("took %f seconds.\n", endTime-startTime); startTime = omp_get_wtime(); printf ("calling algorithm 3:"); - result = algorithm_3(numarray, NUMBERS, countarray); + result = algorithm_3(numarray, NUMBERS, NULL); printf ("sum: %i\n", result); endTime = omp_get_wtime(); printf("took %f seconds.\n", endTime-startTime); diff --git a/openmp/prefix/prefix.h b/openmp/prefix/prefix.h index cf34564..b724faf 100644 --- a/openmp/prefix/prefix.h +++ b/openmp/prefix/prefix.h @@ -1,4 +1,4 @@ #ifndef NUMTYPE #define NUMTYPE -typedef int numtype; +typedef unsigned int numtype; #endif -- 2.43.0