int -> unsigned int
authorDavid Kaufmann <astra@fsinf.at>
Fri, 13 Jan 2012 17:52:19 +0000 (18:52 +0100)
committerDavid Kaufmann <astra@fsinf.at>
Fri, 13 Jan 2012 17:52:19 +0000 (18:52 +0100)
openmp/prefix/algorithm_1.c
openmp/prefix/algorithm_1.h
openmp/prefix/algorithm_2.c
openmp/prefix/algorithm_2.h
openmp/prefix/algorithm_3.c
openmp/prefix/algorithm_3.h
openmp/prefix/prefix.c
openmp/prefix/prefix.h

index ed0a1be5fd8ec23b67e48fc7d20c2e018f20217f..7b549de594f22a1f3a6239da5ebc095d8e165766 100644 (file)
@@ -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;
index c6c9ded08cdf85789a8d294170028750170ec614..f171fcbc1b951a7e7cb5995ef61c8dca53633203 100644 (file)
@@ -4,4 +4,4 @@
 #include <stdio.h>
 #include "prefix.h"
 
-void algorithm_1 (numtype y[], int n, int ops[]);
+void algorithm_1 (numtype y[], unsigned int n, unsigned int ops[]);
index bfef559d228d12afb11f9679aff689d62d759ac5..633c8c7d45cfbef9fdbf9471a232cf41ba8c386c 100644 (file)
@@ -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;
 }
index 5bedbaea8c0df4295ce749978551edd163c482a0..c9e39391fd025953d3db9b5b25a10dcaa3fce450 100644 (file)
@@ -4,4 +4,4 @@
 #include <stdio.h>
 #include "prefix.h"
 
-int algorithm_2 (numtype y[], int n, int ops[]);
+void algorithm_2 (numtype y[], unsigned int n, unsigned int ops[]);
index 943b8c43721e3bfc2b07f60df5c84964887c8e25..1a86a3e9b6a2dbe04a2048194b4a2d81820aa1d1 100644 (file)
@@ -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;
 }
index 92ca0413a66e68eca2d18693b0d834c9c0076030..97e94ce1da8a1e9937b73ee7ac4ae88c07e46e0f 100644 (file)
@@ -4,4 +4,4 @@
 #include <stdio.h>
 #include "prefix.h"
 
-int algorithm_3 (numtype y[], int n, int ops[]);
+void algorithm_3 (numtype y[], unsigned int n, unsigned int ops[]);
index fe8c0aa8e42f227702179b5446bdeb8260286b80..ca6948e3708533d47fc912b28b92febdfc42ee54 100644 (file)
 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);
index cf34564ab469b51f70848a87ab69d59d11a489e3..b724faf603668557e1430fe50a56cedfaed5ade2 100644 (file)
@@ -1,4 +1,4 @@
 #ifndef NUMTYPE
 #define NUMTYPE
-typedef int numtype;
+typedef unsigned int numtype;
 #endif