diff options
author | Agney Lopes Roth Ferraz <agney@debian.org> | 2007-04-09 11:45:31 -0300 |
---|---|---|
committer | Simon Quigley <tsimonq2@ubuntu.com> | 2017-06-19 14:38:41 -0500 |
commit | adb3993ba087ede46f62d5f018e17b07e99b5260 (patch) | |
tree | 67b4fa7e224f09d21eb76060422ca23e50e6dfe0 /arch/common/fib.h | |
parent | b3e31ae3787c8806f48c85a52bba9aa3554e2c07 (diff) | |
parent | 11b8179a57e675c6672cbe649c655230ae3e9744 (diff) |
Import Debian changes 0.4.2.1-1
hardinfo (0.4.2.1-1) unstable; urgency=low
* New upstream release.
* Fixed segfault on device entry (Closes: #387955)
Diffstat (limited to 'arch/common/fib.h')
-rw-r--r-- | arch/common/fib.h | 28 |
1 files changed, 13 insertions, 15 deletions
diff --git a/arch/common/fib.h b/arch/common/fib.h index 493cfd0f..645002fa 100644 --- a/arch/common/fib.h +++ b/arch/common/fib.h @@ -1,6 +1,6 @@ /* * HardInfo - Displays System Information - * Copyright (C) 2003-2006 Leandro A. F. Pereira <leandro@linuxmag.com.br> + * Copyright (C) 2003-2007 Leandro A. F. Pereira <leandro@linuxmag.com.br> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,35 +16,33 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -static unsigned long long -fib(unsigned long long n) +static gulong +fib(gulong n) { if (n == 0) return 0; - else if (n == 1 || n == 2) + else if (n <= 2) return 1; return fib(n - 1) + fib(n - 2); } -static gchar * +static void benchmark_fib(void) { GTimer *timer = g_timer_new(); - gdouble elapsed = 0; + gdouble elapsed; shell_view_set_enabled(FALSE); - shell_status_update("Calculating the 42<sup>th</sup> Fibonacci number..."); + shell_status_update("Calculating the 42nd Fibonacci number..."); + g_timer_reset(timer); g_timer_start(timer); - fib(42); /* the answer? :) */ - g_timer_stop(timer); - elapsed = g_timer_elapsed(timer, NULL); + fib(42); + g_timer_stop(timer); + elapsed = g_timer_elapsed(timer, NULL); g_timer_destroy(timer); - - gchar *retval = g_strdup_printf("[Results <i>(in seconds; lower is better)</i>]\n" - "<b>This Machine</b>=<b>%.2f</b>\n", elapsed); - return benchmark_include_results(retval, "Fibonacci"); + + bench_results[BENCHMARK_FIB] = elapsed; } - |