]> git.ipfire.org Git - people/ms/pakfire.git/commitdiff
Performance check: Count iterations as unsigned long
authorArne Fitzenreiter <arne_f@ipfire.org>
Thu, 24 Nov 2016 20:41:23 +0000 (21:41 +0100)
committerArne Fitzenreiter <arne_f@ipfire.org>
Thu, 24 Nov 2016 20:41:23 +0000 (21:41 +0100)
Signed-off-by: Arne Fitzenreiter <arne_f@ipfire.org>
src/_pakfire/util.c

index 85fc72140be5c40c671f624e3c05ab337208c3a1..aaf50b34dad68eec3f59a22bf595d0e76f1c63b9 100644 (file)
@@ -85,14 +85,14 @@ PyObject *version_compare(PyObject *self, PyObject *args) {
        return Py_BuildValue("i", ret);
 }
 
-static unsigned int fibonnacci(const clock_t* deadline) {
+static unsigned long fibonnacci(const clock_t* deadline) {
        clock_t now = clock();
 
        unsigned long f1 = 1;
        unsigned long f2 = 1;
 
        // Count iterations
-       unsigned int counter = 0;
+       unsigned long counter = 0;
 
        while (now < *deadline) {
                unsigned long next = f1 + f2;
@@ -126,7 +126,7 @@ PyObject* performance_index(PyObject* self, PyObject* args) {
        deadline += CLOCKS_PER_SEC * seconds;
 
        // Run Fibonnacci until deadline
-       unsigned int iterations = fibonnacci(&deadline);
+       unsigned long iterations = fibonnacci(&deadline);
 
        // Times the result by the number of processors
        iterations *= processors;