From: Arne Fitzenreiter Date: Thu, 24 Nov 2016 20:41:23 +0000 (+0100) Subject: Performance check: Count iterations as unsigned long X-Git-Tag: 0.9.28~1295 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=d593e845e3b27d3170f31578de6dd968d3ab01e5;p=pakfire.git Performance check: Count iterations as unsigned long Signed-off-by: Arne Fitzenreiter --- diff --git a/src/_pakfire/util.c b/src/_pakfire/util.c index 85fc72140..aaf50b34d 100644 --- a/src/_pakfire/util.c +++ b/src/_pakfire/util.c @@ -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;